Kaydet (Commit) 81a22db4 authored tarafından Nigel Hawkins's avatar Nigel Hawkins

Remove use of SvLongs in itrform2.[ch]xx

üst 098e422d
...@@ -1511,21 +1511,18 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) ...@@ -1511,21 +1511,18 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
// before and after the BuildPortions call // before and after the BuildPortions call
const sal_Bool bOptimizeRepaint = AllowRepaintOpt(); const sal_Bool bOptimizeRepaint = AllowRepaintOpt();
const xub_StrLen nOldLineEnd = nStartPos + pCurr->GetLen(); const xub_StrLen nOldLineEnd = nStartPos + pCurr->GetLen();
SvLongs* pFlyStart = 0; std::vector<long> flyStarts;
// these are the conditions for a fly position comparison // these are the conditions for a fly position comparison
if ( bOptimizeRepaint && pCurr->IsFly() ) if ( bOptimizeRepaint && pCurr->IsFly() )
{ {
pFlyStart = new SvLongs;
SwLinePortion* pPor = pCurr->GetFirstPortion(); SwLinePortion* pPor = pCurr->GetFirstPortion();
long nPOfst = 0; long nPOfst = 0;
USHORT nCnt = 0;
while ( pPor ) while ( pPor )
{ {
if ( pPor->IsFlyPortion() ) if ( pPor->IsFlyPortion() )
// insert start value of fly portion // insert start value of fly portion
pFlyStart->Insert( nPOfst, nCnt++ ); flyStarts.push_back( nPOfst );
nPOfst += pPor->Width(); nPOfst += pPor->Width();
pPor = pPor->GetPortion(); pPor = pPor->GetPortion();
...@@ -1616,9 +1613,8 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos ) ...@@ -1616,9 +1613,8 @@ xub_StrLen SwTxtFormatter::FormatLine( const xub_StrLen nStartPos )
// calculate optimal repaint rectangle // calculate optimal repaint rectangle
if ( bOptimizeRepaint ) if ( bOptimizeRepaint )
{ {
GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, pFlyStart ) ); GetInfo().SetPaintOfst( CalcOptRepaint( nOldLineEnd, flyStarts ) );
if ( pFlyStart ) flyStarts.clear();
delete pFlyStart;
} }
else else
// Special case: We do not allow an optimitation of the repaint // Special case: We do not allow an optimitation of the repaint
...@@ -2016,7 +2012,7 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const ...@@ -2016,7 +2012,7 @@ sal_Bool SwTxtFormatter::AllowRepaintOpt() const
* calculates an optimal repaint offset for the current line * calculates an optimal repaint offset for the current line
*************************************************************************/ *************************************************************************/
long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd, long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
const SvLongs* pFlyStart ) const std::vector<long> &rFlyStarts )
{ {
if ( GetInfo().GetIdx() < GetInfo().GetReformatStart() ) if ( GetInfo().GetIdx() < GetInfo().GetReformatStart() )
// the reformat position is behind our new line, that means // the reformat position is behind our new line, that means
...@@ -2027,7 +2023,7 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd, ...@@ -2027,7 +2023,7 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
// in case we do not have any fly in our line, our repaint position // in case we do not have any fly in our line, our repaint position
// is the changed position - 1 // is the changed position - 1
if ( ! pFlyStart && ! pCurr->IsFly() ) if ( rFlyStarts.empty() && ! pCurr->IsFly() )
{ {
// this is the maximum repaint offset determined during formatting // this is the maximum repaint offset determined during formatting
// for example: the beginning of the first right tab stop // for example: the beginning of the first right tab stop
...@@ -2105,9 +2101,8 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd, ...@@ -2105,9 +2101,8 @@ long SwTxtFormatter::CalcOptRepaint( xub_StrLen nOldLineEnd,
if ( pPor->IsFlyPortion() ) if ( pPor->IsFlyPortion() )
{ {
// compare start of fly with former start of fly // compare start of fly with former start of fly
if ( pFlyStart && if (nCnt < rFlyStarts.size() &&
nCnt < pFlyStart->Count() && nX == rFlyStarts[ nCnt ] &&
nX == (*pFlyStart)[ nCnt ] &&
nIdx < nReformat nIdx < nReformat
) )
// found fix position, nothing has changed left from nX // found fix position, nothing has changed left from nX
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#define _ITRFORM2_HXX #define _ITRFORM2_HXX
#include "itrpaint.hxx" #include "itrpaint.hxx"
#include <vector>
class SwFlyCntPortion; class SwFlyCntPortion;
class SwInterHyphInfo; class SwInterHyphInfo;
class SwDropPortion; class SwDropPortion;
...@@ -39,7 +41,6 @@ class SwErgoSumPortion; ...@@ -39,7 +41,6 @@ class SwErgoSumPortion;
class SwExpandPortion; class SwExpandPortion;
class SwMultiPortion; class SwMultiPortion;
class SwFtnPortion; class SwFtnPortion;
class SvLongs;
/************************************************************************* /*************************************************************************
* class SwTxtFormatter * class SwTxtFormatter
...@@ -102,7 +103,7 @@ class SwTxtFormatter : public SwTxtPainter ...@@ -102,7 +103,7 @@ class SwTxtFormatter : public SwTxtPainter
sal_Bool AllowRepaintOpt() const; sal_Bool AllowRepaintOpt() const;
// calculates and sets the optimized repaint offset // calculates and sets the optimized repaint offset
long CalcOptRepaint( xub_StrLen nOldLineEnd, const SvLongs* pFlyStart ); long CalcOptRepaint( xub_StrLen nOldLineEnd, const std::vector<long> &rFlyStarts );
// wird von FormatLine gerufen. // wird von FormatLine gerufen.
void FormatReset( SwTxtFormatInfo &rInf ); void FormatReset( SwTxtFormatInfo &rInf );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment