Kaydet (Commit) d707d025 authored tarafından Takeshi Abe's avatar Takeshi Abe Kaydeden (comit) Michael Stahl

fdo#75757: remove inheritance to std::vector

from ParagraphObj, by using boost::ptr_vector.

This is also a supposed fix for ParagraphObj::operator=(),
because ParagraphObj::ImplClear() now makes the vector empty
while its original code kept deleted pointers.

Change-Id: I7710eb33fc05bed55474ff00baaeb8e19cd79f3d
Reviewed-on: https://gerrit.libreoffice.org/11379Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
Tested-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 997d1387
...@@ -659,7 +659,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) ...@@ -659,7 +659,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = false ) for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = false )
{ {
ParagraphObj* pPara = rTextObj.GetParagraph(i); ParagraphObj* pPara = rTextObj.GetParagraph(i);
PortionObj* pPortion = pPara->front(); const PortionObj& rPortion = pPara->front();
nCharCount = pPara->CharacterCount(); nCharCount = pPara->CharacterCount();
nDepth = pPara->nDepth; nDepth = pPara->nDepth;
...@@ -671,7 +671,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) ...@@ -671,7 +671,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
nPropertyFlags |= 0x00000800; nPropertyFlags |= 0x00000800;
nLineSpacing = pPara->mnLineSpacing; nLineSpacing = pPara->mnLineSpacing;
const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont ); const FontCollectionEntry* pDesc = maFontCollection.GetById( rPortion.mnFont );
sal_Int16 nNormalSpacing = 100; sal_Int16 nNormalSpacing = 100;
if ( !mbFontIndependentLineSpacing && pDesc ) if ( !mbFontIndependentLineSpacing && pDesc )
{ {
...@@ -693,7 +693,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj ) ...@@ -693,7 +693,7 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
} }
else else
{ {
if ( !pPara->mbFixedLineSpacing && pPortion->mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point if ( !pPara->mbFixedLineSpacing && rPortion.mnCharHeight > (sal_uInt16)( ((double)-nLineSpacing) * 0.001 * 72.0 / 2.54 ) ) // 1/100mm to point
nLineSpacing = nNormalSpacing; nLineSpacing = nNormalSpacing;
else else
nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 ); nLineSpacing = (sal_Int16)( (double)nLineSpacing / 4.40972 );
...@@ -799,12 +799,12 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) ...@@ -799,12 +799,12 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i ) for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i )
{ {
ParagraphObj* pPara = rTextObj.GetParagraph(i); ParagraphObj* pPara = rTextObj.GetParagraph(i);
for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it ) for ( boost::ptr_vector<PortionObj>::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
{ {
PortionObj* pPortion = *it; const PortionObj& rPortion = *it;
nPropertyFlags = 0; nPropertyFlags = 0;
sal_uInt32 nCharAttr = pPortion->mnCharAttr; sal_uInt32 nCharAttr = rPortion.mnCharAttr;
sal_uInt32 nCharColor = pPortion->mnCharColor; sal_uInt32 nCharColor = rPortion.mnCharColor;
if ( nCharColor == COL_AUTO ) // nCharColor depends to the background color if ( nCharColor == COL_AUTO ) // nCharColor depends to the background color
{ {
...@@ -917,19 +917,19 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) ...@@ -917,19 +917,19 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
nPropertyFlags |= nCharAttr & 0x217; // not all attributes ar inherited nPropertyFlags |= nCharAttr & 0x217; // not all attributes ar inherited
else else
{ {
if ( /* ( pPortion->mnCharAttrHard & 1 ) || */ if ( /* ( rPortion.mnCharAttrHard & 1 ) || */
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Bold, nCharAttr ) ) )
nPropertyFlags |= 1; nPropertyFlags |= 1;
if ( /* ( pPortion->mnCharAttrHard & 2 ) || */ if ( /* ( rPortion.mnCharAttrHard & 2 ) || */
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Italic, nCharAttr ) ) )
nPropertyFlags |= 2; nPropertyFlags |= 2;
if ( /* ( pPortion->mnCharAttrHard & 4 ) || */ if ( /* ( rPortion.mnCharAttrHard & 4 ) || */
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Underline, nCharAttr ) ) )
nPropertyFlags |= 4; nPropertyFlags |= 4;
if ( /* ( pPortion->mnCharAttrHard & 0x10 ) || */ if ( /* ( rPortion.mnCharAttrHard & 0x10 ) || */
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Shadow, nCharAttr ) ) )
nPropertyFlags |= 0x10; nPropertyFlags |= 0x10;
if ( /* ( pPortion->mnCharAttrHard & 0x200 ) || */ if ( /* ( rPortion.mnCharAttrHard & 0x200 ) || */
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Embossed, nCharAttr ) ) )
nPropertyFlags |= 512; nPropertyFlags |= 512;
} }
...@@ -938,23 +938,23 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) ...@@ -938,23 +938,23 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
nPropertyFlags |= ( i & 0x3f ) << 10 ; nPropertyFlags |= ( i & 0x3f ) << 10 ;
nCharAttr |= ( i & 0x3f ) << 10; nCharAttr |= ( i & 0x3f ) << 10;
} }
if ( ( pPortion->meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) || if ( ( rPortion.meFontName == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, pPortion->mnFont ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Font, rPortion.mnFont ) ) )
nPropertyFlags |= 0x00010000; nPropertyFlags |= 0x00010000;
if ( ( pPortion->meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) || if ( ( rPortion.meAsianOrComplexFont == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, pPortion->mnAsianOrComplexFont ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_AsianOrComplexFont, rPortion.mnAsianOrComplexFont ) ) )
nPropertyFlags |= 0x00200000; nPropertyFlags |= 0x00200000;
if ( ( pPortion->meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) || if ( ( rPortion.meCharHeight == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, pPortion->mnCharHeight ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontHeight, rPortion.mnCharHeight ) ) )
nPropertyFlags |= 0x00020000; nPropertyFlags |= 0x00020000;
if ( ( pPortion->meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) || if ( ( rPortion.meCharColor == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_FontColor, nCharColor & 0xffffff ) ) )
nPropertyFlags |= 0x00040000; nPropertyFlags |= 0x00040000;
if ( ( pPortion->meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) || if ( ( rPortion.meCharEscapement == ::com::sun::star::beans::PropertyState_DIRECT_VALUE ) ||
( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, pPortion->mnCharEscapement ) ) ) ( mpStyleSheet->IsHardAttribute( nInstance, pPara->nDepth, CharAttr_Escapement, rPortion.mnCharEscapement ) ) )
nPropertyFlags |= 0x00080000; nPropertyFlags |= 0x00080000;
sal_uInt32 nCharCount = pPortion->Count(); sal_uInt32 nCharCount = rPortion.Count();
rOut.WriteUInt32( nCharCount ) rOut.WriteUInt32( nCharCount )
.WriteUInt32( nPropertyFlags ); //PropertyFlags .WriteUInt32( nPropertyFlags ); //PropertyFlags
...@@ -962,15 +962,15 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj ) ...@@ -962,15 +962,15 @@ void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
if ( nPropertyFlags & 0xffff ) if ( nPropertyFlags & 0xffff )
rOut.WriteUInt16( (sal_uInt16)( nCharAttr ) ); rOut.WriteUInt16( (sal_uInt16)( nCharAttr ) );
if ( nPropertyFlags & 0x00010000 ) if ( nPropertyFlags & 0x00010000 )
rOut.WriteUInt16( pPortion->mnFont ); rOut.WriteUInt16( rPortion.mnFont );
if ( nPropertyFlags & 0x00200000 ) if ( nPropertyFlags & 0x00200000 )
rOut.WriteUInt16( pPortion->mnAsianOrComplexFont ); rOut.WriteUInt16( rPortion.mnAsianOrComplexFont );
if ( nPropertyFlags & 0x00020000 ) if ( nPropertyFlags & 0x00020000 )
rOut.WriteUInt16( (sal_uInt16)( pPortion->mnCharHeight ) ); rOut.WriteUInt16( (sal_uInt16)( rPortion.mnCharHeight ) );
if ( nPropertyFlags & 0x00040000 ) if ( nPropertyFlags & 0x00040000 )
rOut.WriteUInt32( (sal_uInt32)nCharColor ); rOut.WriteUInt32( (sal_uInt32)nCharColor );
if ( nPropertyFlags & 0x00080000 ) if ( nPropertyFlags & 0x00080000 )
rOut.WriteInt16( pPortion->mnCharEscapement ); rOut.WriteInt16( rPortion.mnCharEscapement );
} }
} }
} }
...@@ -1039,15 +1039,15 @@ void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropert ...@@ -1039,15 +1039,15 @@ void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropert
ParagraphObj* pPara = rTextObj.GetParagraph(0); ParagraphObj* pPara = rTextObj.GetParagraph(0);
if ( !pPara->empty() ) if ( !pPara->empty() )
{ {
PortionObj* pPortion = pPara->front(); const PortionObj& rPortion = pPara->front();
sal_Int16 nLineSpacing = pPara->mnLineSpacing; sal_Int16 nLineSpacing = pPara->mnLineSpacing;
const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont ); const FontCollectionEntry* pDesc = maFontCollection.GetById( rPortion.mnFont );
if ( pDesc ) if ( pDesc )
nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 ); nLineSpacing = (sal_Int16)( (double)nLineSpacing * pDesc->Scaling + 0.5 );
if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) ) if ( ( nLineSpacing > 0 ) && ( nLineSpacing < 100 ) )
{ {
double fCharHeight = pPortion->mnCharHeight; double fCharHeight = rPortion.mnCharHeight;
fCharHeight *= 2540 / 72; fCharHeight *= 2540 / 72;
fCharHeight *= 100 - nLineSpacing; fCharHeight *= 100 - nLineSpacing;
fCharHeight /= 100; fCharHeight /= 100;
...@@ -1098,12 +1098,12 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u ...@@ -1098,12 +1098,12 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i ) for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
{ {
pPara = aTextObj.GetParagraph(i); pPara = aTextObj.GetParagraph(i);
for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it ) for ( boost::ptr_vector<PortionObj>::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
{ {
PortionObj* pPortion = *it; const PortionObj& rPortion = *it;
if ( pPortion->mpFieldEntry ) if ( rPortion.mpFieldEntry )
{ {
const FieldEntry* pFieldEntry = pPortion->mpFieldEntry; const FieldEntry* pFieldEntry = rPortion.mpFieldEntry;
switch ( pFieldEntry->nFieldType >> 28 ) switch ( pFieldEntry->nFieldType >> 28 )
{ {
...@@ -3859,16 +3859,16 @@ void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm ) ...@@ -3859,16 +3859,16 @@ void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i ) for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i )
{ {
ParagraphObj* pPtr = GetParagraph(i); ParagraphObj* pPtr = GetParagraph(i);
for ( ParagraphObj::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it ) for ( boost::ptr_vector<PortionObj>::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it )
{ {
PortionObj* pPortion = *it; const PortionObj& rPortion = *it;
sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize; sal_Int32 nPortionSize = rPortion.mnTextSize >= nCharactersLeft ? nCharactersLeft : rPortion.mnTextSize;
sal_Int32 nFlags = 7; sal_Int32 nFlags = 7;
nCharactersLeft -= nPortionSize; nCharactersLeft -= nPortionSize;
pStrm ->WriteUInt32( static_cast< sal_uInt32 >( nPortionSize ) ) pStrm ->WriteUInt32( static_cast< sal_uInt32 >( nPortionSize ) )
.WriteInt32( nFlags ) .WriteInt32( nFlags )
.WriteInt16( static_cast< sal_Int16 >( 1 ) ) // spellinfo -> needs rechecking .WriteInt16( static_cast< sal_Int16 >( 1 ) ) // spellinfo -> needs rechecking
.WriteInt16( static_cast< sal_Int16 >( LanguageTag( pPortion->meCharLocale ).makeFallback().getLanguageType() ) ) .WriteInt16( static_cast< sal_Int16 >( LanguageTag( rPortion.meCharLocale ).makeFallback().getLanguageType() ) )
.WriteInt16( static_cast< sal_Int16 >( 0 ) ); // alt language .WriteInt16( static_cast< sal_Int16 >( 0 ) ); // alt language
} }
} }
......
...@@ -648,7 +648,10 @@ PortionObj& PortionObj::operator=( const PortionObj& rPortionObj ) ...@@ -648,7 +648,10 @@ PortionObj& PortionObj::operator=( const PortionObj& rPortionObj )
ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
PPTExBulletProvider& rProv) PPTExBulletProvider& rProv)
: maMapModeSrc(MAP_100TH_MM) : PropStateValue()
, SOParagraph()
, mvPortions()
, maMapModeSrc(MAP_100TH_MM)
, maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 )) , maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ))
, mnTextSize(0) , mnTextSize(0)
, mbFirstParagraph(false) , mbFirstParagraph(false)
...@@ -675,7 +678,10 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s ...@@ -675,7 +678,10 @@ ParagraphObj::ParagraphObj(const ::com::sun::star::uno::Reference< ::com::sun::s
ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent, ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > & rXTextContent,
ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv ) ParaFlags aParaFlags, FontCollection& rFontCollection, PPTExBulletProvider& rProv )
: maMapModeSrc(MAP_100TH_MM) : PropStateValue()
, SOParagraph()
, mvPortions()
, maMapModeSrc(MAP_100TH_MM)
, maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 )) , maMapModeDest(MAP_INCH, Point(), Fraction( 1, 576 ), Fraction( 1, 576 ))
, mnTextSize(0) , mnTextSize(0)
, mbIsBullet(false) , mbIsBullet(false)
...@@ -730,7 +736,7 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t ...@@ -730,7 +736,7 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t
{ {
PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection ); PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
if ( pPortionObj->Count() ) if ( pPortionObj->Count() )
push_back( pPortionObj ); mvPortions.push_back( pPortionObj );
else else
delete pPortionObj; delete pPortionObj;
} }
...@@ -742,9 +748,9 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t ...@@ -742,9 +748,9 @@ ParagraphObj::ParagraphObj(::com::sun::star::uno::Reference< ::com::sun::star::t
} }
ParagraphObj::ParagraphObj( const ParagraphObj& rObj ) ParagraphObj::ParagraphObj( const ParagraphObj& rObj )
: std::vector<PortionObj*>() : PropStateValue()
, PropStateValue()
, SOParagraph() , SOParagraph()
, mvPortions()
{ {
ImplConstruct( rObj ); ImplConstruct( rObj );
} }
...@@ -756,14 +762,13 @@ ParagraphObj::~ParagraphObj() ...@@ -756,14 +762,13 @@ ParagraphObj::~ParagraphObj()
void ParagraphObj::Write( SvStream* pStrm ) void ParagraphObj::Write( SvStream* pStrm )
{ {
for ( const_iterator it = begin(); it != end(); ++it ) for ( boost::ptr_vector<PortionObj>::iterator it = mvPortions.begin(); it != mvPortions.end(); ++it )
(*it)->Write( pStrm, mbLastParagraph ); it->Write( pStrm, mbLastParagraph );
} }
void ParagraphObj::ImplClear() void ParagraphObj::ImplClear()
{ {
for ( const_iterator it = begin(); it != end(); ++it ) mvPortions.clear();
delete *it;
} }
void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight ) void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
...@@ -922,8 +927,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1 ...@@ -922,8 +927,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
} }
} }
PortionObj* pPortion = front(); CalculateGraphicBulletSize( ( mvPortions.empty() ) ? 24 : mvPortions.front().mnCharHeight );
CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 );
switch( nNumberingType ) switch( nNumberingType )
{ {
...@@ -1235,8 +1239,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj ) ...@@ -1235,8 +1239,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj )
mbForbiddenRules = rParagraphObj.mbForbiddenRules; mbForbiddenRules = rParagraphObj.mbForbiddenRules;
mnBiDi = rParagraphObj.mnBiDi; mnBiDi = rParagraphObj.mnBiDi;
for ( ParagraphObj::const_iterator it = rParagraphObj.begin(); it != rParagraphObj.end(); ++it ) for ( boost::ptr_vector<PortionObj>::const_iterator it = rParagraphObj.begin(); it != rParagraphObj.end(); ++it )
push_back( new PortionObj( **it ) ); mvPortions.push_back( new PortionObj( *it ) );
maTabStop = rParagraphObj.maTabStop; maTabStop = rParagraphObj.maTabStop;
bExtendedParameters = rParagraphObj.bExtendedParameters; bExtendedParameters = rParagraphObj.bExtendedParameters;
...@@ -1264,8 +1268,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj ) ...@@ -1264,8 +1268,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj )
sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition ) sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
{ {
mnTextSize = 0; mnTextSize = 0;
for ( const_iterator it = begin(); it != end(); ++it ) for ( boost::ptr_vector<PortionObj>::iterator it = mvPortions.begin(); it != mvPortions.end(); ++it )
mnTextSize += (*it)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize ); mnTextSize += it->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
return mnTextSize; return mnTextSize;
} }
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include <com/sun/star/awt/FontDescriptor.hpp> #include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/Locale.hpp>
#include <editeng/svxenum.hxx> #include <editeng/svxenum.hxx>
#include <boost/ptr_container/ptr_vector.hpp>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
...@@ -172,11 +172,12 @@ struct ParaFlags ...@@ -172,11 +172,12 @@ struct ParaFlags
ParaFlags() { bFirstParagraph = true; bLastParagraph = false; }; ParaFlags() { bFirstParagraph = true; bLastParagraph = false; };
}; };
class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, public SOParagraph class ParagraphObj : public PropStateValue, public SOParagraph
{ {
friend class TextObj; friend class TextObj;
friend struct PPTExParaSheet; friend struct PPTExParaSheet;
boost::ptr_vector<PortionObj> mvPortions;
MapMode maMapModeSrc; MapMode maMapModeSrc;
MapMode maMapModeDest; MapMode maMapModeDest;
...@@ -223,6 +224,13 @@ class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, pub ...@@ -223,6 +224,13 @@ class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, pub
ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef, ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSetRef,
PPTExBulletProvider& rBuProv ); PPTExBulletProvider& rBuProv );
bool empty() const { return mvPortions.empty(); }
const PortionObj& front() const { return mvPortions.front(); }
boost::ptr_vector<PortionObj>::const_iterator begin() const { return mvPortions.begin(); }
boost::ptr_vector<PortionObj>::const_iterator end() const { return mvPortions.end(); }
void CalculateGraphicBulletSize( sal_uInt16 nFontHeight ); void CalculateGraphicBulletSize( sal_uInt16 nFontHeight );
~ParagraphObj(); ~ParagraphObj();
......
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