Kaydet (Commit) 21ab4188 authored tarafından Michael Stahl's avatar Michael Stahl

sw: replace that awful constructor that overloads SwTxtPortion copy-ctor

... with a CopyLinePortion function; how can you even...

Change-Id: Ie7d459ee317522e35fdbbd3974afabe7a136fe62
üst ba587924
......@@ -139,7 +139,7 @@ SwLinePortion *SwLineLayout::Insert( SwLinePortion *pIns )
{
if( GetLen() )
{
pPortion = new SwTxtPortion(*static_cast<SwLinePortion*>(this));
pPortion = SwTxtPortion::CopyLinePortion(*this);
if( IsBlinking() && pBlink )
{
SetBlinking( false );
......@@ -161,7 +161,7 @@ SwLinePortion *SwLineLayout::Append( SwLinePortion *pIns )
// First attribute change: copy mass and length from *pIns into the first
// text portion
if( !pPortion )
pPortion = new SwTxtPortion(*static_cast<SwLinePortion*>(this));
pPortion = SwTxtPortion::CopyLinePortion(*this);
// Call with scope or we'll end up with recursion!
return pPortion->SwLinePortion::Append( pIns );
}
......@@ -184,7 +184,7 @@ SwMarginPortion *SwLineLayout::CalcLeftMargin()
SwMarginPortion *pLeft = (GetPortion() && GetPortion()->IsMarginPortion()) ?
static_cast<SwMarginPortion *>(GetPortion()) : 0;
if( !GetPortion() )
SetPortion(new SwTxtPortion(*static_cast<SwLinePortion*>(this)));
SetPortion(SwTxtPortion::CopyLinePortion(*this));
if( !pLeft )
{
pLeft = new SwMarginPortion( 0 );
......
......@@ -678,7 +678,7 @@ void SwRubyPortion::_Adjust( SwTxtFormatInfo &rInf )
if( nLeft || nRight )
{
if( !pCurr->GetPortion() )
pCurr->SetPortion(new SwTxtPortion(*static_cast<SwLinePortion*>(pCurr)));
pCurr->SetPortion(SwTxtPortion::CopyLinePortion(*pCurr));
if( nLeft )
{
SwMarginPortion *pMarg = new SwMarginPortion( 0 );
......
......@@ -208,10 +208,12 @@ static sal_Int32 lcl_AddSpace( const SwTxtSizeInfo &rInf, const OUString* pStr,
return nCnt;
}
SwTxtPortion::SwTxtPortion( const SwLinePortion &rPortion )
: SwLinePortion( rPortion )
SwTxtPortion * SwTxtPortion::CopyLinePortion(const SwLinePortion &rPortion)
{
SetWhichPor( POR_TXT );
SwTxtPortion *const pNew(new SwTxtPortion);
static_cast<SwLinePortion&>(*pNew) = rPortion;
pNew->SetWhichPor( POR_TXT ); // overwrite that!
return pNew;
}
void SwTxtPortion::BreakCut( SwTxtFormatInfo &rInf, const SwTxtGuess &rGuess )
......
......@@ -34,7 +34,7 @@ class SwTxtPortion : public SwLinePortion
public:
inline SwTxtPortion(){ SetWhichPor( POR_TXT ); }
SwTxtPortion( const SwLinePortion &rPortion );
static SwTxtPortion * CopyLinePortion(const SwLinePortion &rPortion);
virtual void Paint( const SwTxtPaintInfo &rInf ) const SAL_OVERRIDE;
virtual bool Format( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
virtual void FormatEOL( SwTxtFormatInfo &rInf ) SAL_OVERRIDE;
......
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