[Libreoffice-commits] .: 9 commits - filter/inc filter/source sd/source svtools/inc svtools/source svx/inc tools/inc tools/source
Michael Stahl
mst at kemper.freedesktop.org
Mon Aug 13 13:50:46 PDT 2012
filter/inc/filter/msfilter/svdfppt.hxx | 18 +-
filter/source/msfilter/svdfppt.cxx | 227 +++++++++++++++------------------
sd/source/filter/eppt/eppt.cxx | 16 --
sd/source/filter/eppt/eppt.hxx | 2
sd/source/filter/eppt/epptso.cxx | 60 +++++---
sd/source/filter/eppt/pptx-text.cxx | 38 ++---
sd/source/filter/eppt/text.hxx | 9 -
sd/source/ui/dlg/animobjs.cxx | 34 ++--
sd/source/ui/dlg/present.cxx | 1
sd/source/ui/inc/animobjs.hxx | 3
svtools/inc/svtools/ivctrl.hxx | 2
svtools/inc/svtools/svlbox.hxx | 2
svtools/source/uno/treecontrolpeer.hxx | 2
svx/inc/svx/xtable.hxx | 2
tools/inc/tools/contnr.hxx | 2
tools/inc/tools/list.hxx | 1
tools/source/inet/inetmsg.cxx | 6
17 files changed, 209 insertions(+), 216 deletions(-)
New commits:
commit bf70f37c9243b6c94318f093871563c8c3784aa6
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 15:23:04 2012 +0200
Convert aTimeList field in AnimationWindow from tools/list.hxx to std::vector
Change-Id: I45893027fc33ee07e4fbddec06ab8949c58ed316
diff --git a/sd/source/ui/dlg/animobjs.cxx b/sd/source/ui/dlg/animobjs.cxx
index 2bdb9b2..5d2e7df 100644
--- a/sd/source/ui/dlg/animobjs.cxx
+++ b/sd/source/ui/dlg/animobjs.cxx
@@ -231,9 +231,9 @@ AnimationWindow::~AnimationWindow()
aBmpExList.Clear();
// Timeliste bereinigen
- for( i = 0, nCount = aTimeList.Count(); i < nCount; i++ )
- delete static_cast< Time* >( aTimeList.GetObject( i ) );
- aTimeList.Clear();
+ for( i = 0, nCount = aTimeList.size(); i < nCount; i++ )
+ delete aTimeList[ i ];
+ aTimeList.clear();
// die Clones loeschen
delete pMyDoc;
@@ -280,7 +280,7 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, void *, p )
if( aRbtBitmap.IsChecked() )
{
for( sal_uLong i = 0; i < nCount; i++ )
- aTime += *static_cast< Time* >( aTimeList.GetObject( i ) );
+ aTime += *aTimeList[ i ];
nFullTime = aTime.GetMSFromTime();
}
else
@@ -318,7 +318,7 @@ IMPL_LINK( AnimationWindow, ClickPlayHdl, void *, p )
if( aRbtBitmap.IsChecked() )
{
- Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) );
+ Time* pTime = aTimeList[i];
DBG_ASSERT( pTime, "Keine Zeit gefunden!" );
aTimeField.SetTime( *pTime );
@@ -400,7 +400,7 @@ IMPL_LINK( AnimationWindow, ClickRbtHdl, void *, p )
sal_uLong n = static_cast<sal_uLong>(aNumFldBitmap.GetValue());
if( n > 0 )
{
- Time* pTime = static_cast< Time* >( aTimeList.GetObject( n - 1 ) );
+ Time* pTime = aTimeList[ n - 1 ];
if( pTime )
aTimeField.SetTime( *pTime );
}
@@ -442,11 +442,11 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn )
aBmpExList.Remove();
pBitmapEx = static_cast< BitmapEx* >( aBmpExList.GetCurObject() );
}
- Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) );
+ Time* pTime = aTimeList[ nPos ];
if( pTime )
{
delete pTime;
- aTimeList.Remove( nPos );
+ aTimeList.erase( aTimeList.begin() + nPos );
}
pObject = pPage->GetObj( nPos );
@@ -490,12 +490,12 @@ IMPL_LINK( AnimationWindow, ClickRemoveBitmapHdl, void *, pBtn )
aBmpExList.Clear();
// Timeliste bereinigen
- nCount = aTimeList.Count();
+ nCount = aTimeList.size();
for( i = 0; i < nCount; i++ )
{
- delete static_cast< Time* >( aTimeList.GetObject( i ) );
+ delete aTimeList[ i ];
}
- aTimeList.Clear();
+ aTimeList.clear();
}
}
@@ -554,7 +554,7 @@ IMPL_LINK_NOARG(AnimationWindow, ModifyTimeHdl)
{
sal_uLong nPos = static_cast<sal_uLong>(aNumFldBitmap.GetValue() - 1);
- Time* pTime = static_cast< Time* >( aTimeList.GetObject( nPos ) );
+ Time* pTime = aTimeList[ nPos ];
DBG_ASSERT( pTime, "Zeit nicht gefunden!" );
*pTime = aTimeField.GetTime();
@@ -919,7 +919,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
// Time
long nTime = rAnimBmp.nWait;
Time* pTime = new Time( 0, 0, nTime / 100, nTime % 100 );
- aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+ aTimeList.insert( aTimeList.begin() + aBmpExList.GetCurPos() + 1, pTime );
// Weiterschalten der BitmapListe
aBmpExList.Next();
@@ -944,7 +944,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
// Time
Time* pTime = new Time( aTimeField.GetTime() );
- aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+ aTimeList.insert( aTimeList.begin() + aBmpExList.GetCurPos() + 1, pTime );
// Clone
pPage->InsertObject( pSnapShot->Clone(), aBmpExList.GetCurPos() + 1 );
@@ -963,7 +963,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
// Time
Time* pTime = new Time( aTimeField.GetTime() );
- aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+ aTimeList.insert( aTimeList.begin() + aBmpExList.GetCurPos() + 1, pTime );
}
@@ -991,7 +991,7 @@ void AnimationWindow::AddObj (::sd::View& rView )
// Time
Time* pTime = new Time( aTimeField.GetTime() );
- aTimeList.Insert( pTime, aBmpExList.GetCurPos() + 1 );
+ aTimeList.insert( aTimeList.begin() + aBmpExList.GetCurPos() + 1, pTime );
pPage->InsertObject( pObject->Clone(), aBmpExList.GetCurPos() + 1 );
@@ -1075,7 +1075,7 @@ void AnimationWindow::CreateAnimObj (::sd::View& rView )
for( i = 0; i < nCount; i++ )
{
- Time* pTime = static_cast< Time* >( aTimeList.GetObject( i ) );
+ Time* pTime = aTimeList[i];
long nTime = pTime->Get100Sec();
nTime += pTime->GetSec() * 100;
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index 77ac160..7008edc 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -130,7 +130,7 @@ private:
::Window* pWin;
List aBmpExList;
- List aTimeList;
+ std::vector<Time*> aTimeList;
SdDrawDocument* pMyDoc;
BitmapEx* pBitmapEx;
commit 0beb6bc4b39caca5c62bdb6c17d89210119a12e5
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 13:26:32 2012 +0200
Convert from tools/list.hxx to tools/contnr.hxx
Most places don't need to include tools/list.hxx
Change-Id: Ib2415fbbf92b039a77e1f5c21856f03de60262d4
diff --git a/sd/source/ui/dlg/present.cxx b/sd/source/ui/dlg/present.cxx
index 54b008e..7fe5a74 100644
--- a/sd/source/ui/dlg/present.cxx
+++ b/sd/source/ui/dlg/present.cxx
@@ -35,7 +35,6 @@
#include <com/sun/star/container/XIndexAccess.hpp>
#include <comphelper/processfactory.hxx>
#include <svl/itemset.hxx>
-#include <tools/list.hxx>
#include "sdattr.hxx"
#include "present.hxx"
diff --git a/sd/source/ui/inc/animobjs.hxx b/sd/source/ui/inc/animobjs.hxx
index eb98552..77ac160 100644
--- a/sd/source/ui/inc/animobjs.hxx
+++ b/sd/source/ui/inc/animobjs.hxx
@@ -25,6 +25,7 @@
#include <svtools/stdctrl.hxx>
#include <vcl/group.hxx>
#include <sfx2/ctrlitem.hxx>
+#include <tools/list.hxx>
#include <vcl/button.hxx>
#include <vcl/field.hxx>
diff --git a/svtools/inc/svtools/ivctrl.hxx b/svtools/inc/svtools/ivctrl.hxx
index ed2ccd8..c4854bf 100644
--- a/svtools/inc/svtools/ivctrl.hxx
+++ b/svtools/inc/svtools/ivctrl.hxx
@@ -33,7 +33,7 @@
#include <tools/string.hxx>
#include <vcl/ctrl.hxx>
#include <tools/link.hxx>
-#include <tools/list.hxx>
+#include <tools/contnr.hxx>
#include <vcl/image.hxx>
#include <vcl/seleng.hxx>
diff --git a/svtools/inc/svtools/svlbox.hxx b/svtools/inc/svtools/svlbox.hxx
index 477de7a..b1ac2ed 100644
--- a/svtools/inc/svtools/svlbox.hxx
+++ b/svtools/inc/svtools/svlbox.hxx
@@ -41,7 +41,7 @@
#include <vcl/mnemonicengine.hxx>
#include <vcl/quickselectionengine.hxx>
#include <tools/gen.hxx>
-#include <tools/list.hxx>
+#include <tools/contnr.hxx>
#include <svtools/treelist.hxx>
#include <svtools/transfer.hxx>
diff --git a/svtools/source/uno/treecontrolpeer.hxx b/svtools/source/uno/treecontrolpeer.hxx
index 5d8b89b..c154d69 100644
--- a/svtools/source/uno/treecontrolpeer.hxx
+++ b/svtools/source/uno/treecontrolpeer.hxx
@@ -40,7 +40,7 @@
#include <cppuhelper/implbase2.hxx>
-#include <tools/list.hxx>
+#include <tools/contnr.hxx>
class UnoTreeListEntry;
class TreeControlPeer;
diff --git a/svx/inc/svx/xtable.hxx b/svx/inc/svx/xtable.hxx
index 4d6fe4e..2f76330 100644
--- a/svx/inc/svx/xtable.hxx
+++ b/svx/inc/svx/xtable.hxx
@@ -39,7 +39,7 @@
#include <tools/color.hxx>
#include <tools/string.hxx>
-#include <tools/list.hxx>
+#include <tools/contnr.hxx>
#include <cppuhelper/weak.hxx>
commit b78c58c8678ad9b4c13f1b5691da66f0d915685f
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 12:45:51 2012 +0200
Convert from including tools/list.hxx to tools/contnr.hxx
Change-Id: I728995adb333df7c647674bba3bca7fe6fef78d0
diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx
index 3940c11..c15f30e 100644
--- a/tools/source/inet/inetmsg.cxx
+++ b/tools/source/inet/inetmsg.cxx
@@ -22,7 +22,7 @@
#include <tools/inetmime.hxx>
#include <tools/inetmsg.hxx>
#include <tools/inetstrm.hxx>
-#include <tools/list.hxx>
+#include <tools/contnr.hxx>
#include <rtl/instance.hxx>
#include <rtl/strbuf.hxx>
#include <comphelper/string.hxx>
@@ -239,7 +239,7 @@ INetRFC822Message::INetRFC822Message()
: INetMessage()
{
for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++)
- m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+ m_nIndex[i] = CONTAINER_ENTRY_NOTFOUND;
}
INetRFC822Message::INetRFC822Message (const INetRFC822Message& rMsg)
@@ -751,7 +751,7 @@ INetMIMEMessage::INetMIMEMessage()
bHeaderParsed (sal_False)
{
for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++)
- m_nIndex[i] = LIST_ENTRY_NOTFOUND;
+ m_nIndex[i] = CONTAINER_ENTRY_NOTFOUND;
}
INetMIMEMessage::INetMIMEMessage (const INetMIMEMessage& rMsg)
commit 9173bdf522375e99c0145b31f027678d8d9c9770
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 11:17:45 2012 +0200
Convert tools/list.hxx to std::vector in maExOleObj field of PPTWriter class
Change-Id: Ie677ef12d8443c36069dd6910b42b81b48beb974
diff --git a/sd/source/filter/eppt/eppt.cxx b/sd/source/filter/eppt/eppt.cxx
index d041683..65d3ff3 100644
--- a/sd/source/filter/eppt/eppt.cxx
+++ b/sd/source/filter/eppt/eppt.cxx
@@ -451,21 +451,18 @@ void PPTWriter::ImplWriteSlideMaster( sal_uInt32 nPageNum, Reference< XPropertyS
PPTWriter::~PPTWriter()
{
- void* pPtr;
delete mpExEmbed;
delete mpPptEscherEx;
delete mpCurUserStrm;
delete mpPicStrm;
delete mpStrm;
-
-
std::vector< PPTExStyleSheet* >::iterator aStyleSheetIter( maStyleSheetList.begin() );
while( aStyleSheetIter < maStyleSheetList.end() )
delete *aStyleSheetIter++;
- for ( pPtr = maExOleObj.First(); pPtr; pPtr = maExOleObj.Next() )
- delete (PPTExOleObjEntry*)pPtr;
+ for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
+ delete *it;
if ( mbStatusIndicator )
mXStatusIndicator->end();
@@ -1287,13 +1284,12 @@ void PPTWriter::ImplWriteVBA()
void PPTWriter::ImplWriteOLE( )
{
- PPTExOleObjEntry* pPtr;
SvxMSExportOLEObjects aOleExport( mnCnvrtFlags );
- for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr;
- pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
+ for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
{
+ PPTExOleObjEntry* pPtr = *it;
SvMemoryStream* pStrm = NULL;
pPtr->nOfsB = mpStrm->Tell();
switch ( pPtr->eType )
@@ -1419,9 +1415,9 @@ sal_Bool PPTWriter::ImplWriteAtomEnding()
}
}
// Ole persists
- PPTExOleObjEntry* pPtr;
- for ( pPtr = (PPTExOleObjEntry*)maExOleObj.First(); pPtr; pPtr = (PPTExOleObjEntry*)maExOleObj.Next() )
+ for ( std::vector<PPTExOleObjEntry*>::const_iterator it = maExOleObj.begin(); it != maExOleObj.end(); ++it )
{
+ PPTExOleObjEntry* pPtr = *it;
nOfs = mpPptEscherEx->PtGetOffsetByID( EPP_Persist_ExObj );
if ( nOfs )
{
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index d368bb9..aa3b65b 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -36,7 +36,6 @@
#include <vcl/graph.hxx>
#include <unotools/fontcvt.hxx>
#include <tools/string.hxx>
-#include <tools/list.hxx>
#include "pptexanimations.hxx"
#include <pptexsoundcollection.hxx>
@@ -197,7 +196,7 @@ class PPTWriter : public PPTWriterBase, public PPTExBulletProvider
SvStream* mpPicStrm;
PptEscherEx* mpPptEscherEx;
- List maExOleObj;
+ std::vector<PPTExOleObjEntry*> maExOleObj;
sal_uInt32 mnVBAOleOfs;
SvMemoryStream* mpVBA;
sal_uInt32 mnExEmbed;
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 8576193..47013f7 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -2559,7 +2559,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
<< nPageId;
PPTExOleObjEntry* pEntry = new PPTExOleObjEntry( OCX_CONTROL, mpExEmbed->Tell() );
pEntry->xControlModel = aXControlModel;
- maExOleObj.Insert( pEntry );
+ maExOleObj.push_back( pEntry );
mnExEmbed++;
@@ -3075,7 +3075,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
PPTExOleObjEntry* pE = new PPTExOleObjEntry( NORMAL_OLE_OBJECT, mpExEmbed->Tell() );
pE->xShape = mXShape;
- maExOleObj.Insert( pE );
+ maExOleObj.push_back( pE );
mnExEmbed++;
commit f5ec08d4d8ff64cbae83e47ac2159eb3a546bc79
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 09:57:31 2012 +0200
Convert ParagraphObj from tools/list.hxx to std::vector
Also convert mpList to maList in ImplTextObject because its
lifecycle is completely tied to it's containing struct.
Change-Id: Ie1a35b604bbe539f3ae1303e3873e47ddae38cbc
diff --git a/sd/source/filter/eppt/eppt.hxx b/sd/source/filter/eppt/eppt.hxx
index f4b60b2..d368bb9 100644
--- a/sd/source/filter/eppt/eppt.hxx
+++ b/sd/source/filter/eppt/eppt.hxx
@@ -36,6 +36,7 @@
#include <vcl/graph.hxx>
#include <unotools/fontcvt.hxx>
#include <tools/string.hxx>
+#include <tools/list.hxx>
#include "pptexanimations.hxx"
#include <pptexsoundcollection.hxx>
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index dcb752f..8576193 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -739,10 +739,11 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
sal_Int16 nLineSpacing;
int nInstance = rTextObj.GetInstance();
- for ( ParagraphObj* pPara = rTextObj.First() ; pPara; pPara = rTextObj.Next(), bFirstParagraph = sal_False )
+ for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i, bFirstParagraph = sal_False )
{
- PortionObj* pPortion = (PortionObj*)pPara->First();
- nCharCount = pPara->Count();
+ ParagraphObj* pPara = rTextObj.GetParagraph(i);
+ PortionObj* pPortion = pPara->front();
+ nCharCount = pPara->size();
nDepth = pPara->nDepth;
if ( nDepth > 4)
@@ -866,13 +867,15 @@ void PPTWriter::ImplWriteParagraphs( SvStream& rOut, TextObj& rTextObj )
void PPTWriter::ImplWritePortions( SvStream& rOut, TextObj& rTextObj )
{
- sal_uInt32 nPropertyFlags, i = 0;
+ sal_uInt32 nPropertyFlags;
int nInstance = rTextObj.GetInstance();
- for ( ParagraphObj* pPara = rTextObj.First(); pPara; pPara = rTextObj.Next(), i++ )
+ for ( sal_uInt32 i = 0; i < rTextObj.ParagraphCount(); ++i )
{
- for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
+ ParagraphObj* pPara = rTextObj.GetParagraph(i);
+ for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
{
+ PortionObj* pPortion = *it;
nPropertyFlags = 0;
sal_uInt32 nCharAttr = pPortion->mnCharAttr;
sal_uInt32 nCharColor = pPortion->mnCharColor;
@@ -1109,12 +1112,12 @@ void PPTWriter::ImplAdjustFirstLineLineSpacing( TextObj& rTextObj, EscherPropert
{
if ( !mbFontIndependentLineSpacing )
{
- ParagraphObj* pPara = rTextObj.First();
- if ( pPara )
+ if ( rTextObj.ParagraphCount() )
{
- PortionObj* pPortion = (PortionObj*)pPara->First();
- if ( pPortion )
+ ParagraphObj* pPara = rTextObj.GetParagraph(0);
+ if ( !pPara->empty() )
{
+ PortionObj* pPortion = pPara->front();
sal_Int16 nLineSpacing = pPara->mnLineSpacing;
const FontCollectionEntry* pDesc = maFontCollection.GetById( pPortion->mnFont );
if ( pDesc )
@@ -1172,10 +1175,12 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
rOut << (sal_uInt32)( nSize - 8 );
rOut.SeekRel( nSize - 8 );
- for ( pPara = aTextObj.First(); pPara; pPara = aTextObj.Next() )
+ for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
{
- for ( PortionObj* pPortion = (PortionObj*)pPara->First(); pPortion; pPortion = (PortionObj*)pPara->Next() )
+ pPara = aTextObj.GetParagraph(i);
+ for ( ParagraphObj::const_iterator it = pPara->begin(); it != pPara->end(); ++it )
{
+ PortionObj* pPortion = *it;
if ( pPortion->mpFieldEntry )
{
const FieldEntry* pFieldEntry = pPortion->mpFieldEntry;
@@ -1282,17 +1287,18 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
aTextObj.WriteTextSpecInfo( &rOut );
// Star Office Default TabSizes schreiben ( wenn noetig )
- pPara = aTextObj.First();
- if ( pPara )
+ if ( aTextObj.ParagraphCount() )
{
+ pPara = aTextObj.GetParagraph(0);
sal_uInt32 nParaFlags = 0x1f;
sal_Int16 nDepth, nMask, nNumberingRule[ 10 ];
sal_uInt32 nTextOfs = pPara->nTextOfs;
sal_uInt32 nTabs = pPara->maTabStop.getLength();
const ::com::sun::star::style::TabStop* pTabStop = ( const ::com::sun::star::style::TabStop* )pPara->maTabStop.getConstArray();
- for ( ; pPara; pPara = aTextObj.Next() )
+ for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
{
+ pPara = aTextObj.GetParagraph(i);
if ( pPara->bExtendedParameters )
{
nDepth = pPara->nDepth;
@@ -1381,16 +1387,17 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
}
if ( aTextObj.HasExtendedBullets() )
{
- ParagraphObj* pBulletPara = aTextObj.First();
- if ( pBulletPara )
+ if ( aTextObj.ParagraphCount() )
{
+ ParagraphObj* pBulletPara = aTextObj.GetParagraph(0);
sal_uInt32 nBulletFlags = 0;
sal_uInt32 nNumberingType = 0, nPos2 = rExtBuStr.Tell();
rExtBuStr << (sal_uInt32)( EPP_PST_ExtendedParagraphAtom << 16 ) << (sal_uInt32)0;
- for ( ; pBulletPara; pBulletPara = aTextObj.Next() )
+ for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount(); ++i )
{
+ pBulletPara = aTextObj.GetParagraph(i);
nBulletFlags = 0;
sal_uInt16 nBulletId = pBulletPara->nBulletId;
if ( pBulletPara->bExtendedBulletsUsed )
@@ -2972,8 +2979,9 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
mnTextSize = aTextObj.Count();
aTextObj.Write( mpStrm );
mpPptEscherEx->BeginAtom();
- for ( ParagraphObj* pPara = aTextObj.First() ; pPara; pPara = aTextObj.Next() )
+ for ( sal_uInt32 i = 0; i < aTextObj.ParagraphCount() ; ++i )
{
+ ParagraphObj* pPara = aTextObj.GetParagraph(i);
sal_uInt32 nCharCount = pPara->Count();
sal_uInt16 nDepth = pPara->nDepth;
if ( nDepth > 4)
@@ -3830,8 +3838,8 @@ void TextObjBinary::Write( SvStream* pStrm )
{
sal_uInt32 nSize, nPos = pStrm->Tell();
*pStrm << (sal_uInt32)( EPP_TextCharsAtom << 16 ) << (sal_uInt32)0;
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- ((ParagraphObj*)pPtr)->Write( pStrm );
+ for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
+ GetParagraph(i)->Write( pStrm );
nSize = pStrm->Tell() - nPos;
pStrm->SeekRel( - ( (sal_Int32)nSize - 4 ) );
*pStrm << (sal_uInt32)( nSize - 8 );
@@ -3844,10 +3852,12 @@ void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
if ( nCharactersLeft >= 1 )
{
EscherExAtom aAnimationInfoAtom( *pStrm, EPP_TextSpecInfoAtom, 0, 0 );
- for ( ParagraphObj* pPtr = static_cast < ParagraphObj * >( First() ); nCharactersLeft && pPtr; pPtr = static_cast< ParagraphObj* >( Next() ) )
+ for ( sal_uInt32 i = 0; nCharactersLeft && i < ParagraphCount(); ++i )
{
- for ( PortionObj* pPortion = static_cast< PortionObj* >( pPtr->First() ); nCharactersLeft && pPortion; pPortion = static_cast< PortionObj* >( pPtr->Next() ) )
+ ParagraphObj* pPtr = GetParagraph(i);
+ for ( ParagraphObj::const_iterator it = pPtr->begin(); nCharactersLeft && it != pPtr->end(); ++it )
{
+ PortionObj* pPortion = *it;
sal_Int32 nPortionSize = pPortion->mnTextSize >= nCharactersLeft ? nCharactersLeft : pPortion->mnTextSize;
sal_Int32 nFlags = 7;
nCharactersLeft -= nPortionSize;
diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx
index f264c7c..f1bc0dd 100644
--- a/sd/source/filter/eppt/pptx-text.cxx
+++ b/sd/source/filter/eppt/pptx-text.cxx
@@ -692,7 +692,7 @@ ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::
{
PortionObj* pPortionObj = new PortionObj( aXCursorText, !aXTextPortionE->hasMoreElements(), rFontCollection );
if ( pPortionObj->Count() )
- Insert( pPortionObj, LIST_APPEND );
+ push_back( pPortionObj );
else
delete pPortionObj;
}
@@ -704,7 +704,7 @@ ParagraphObj::ParagraphObj( const ::com::sun::star::uno::Reference< ::com::sun::
}
ParagraphObj::ParagraphObj( const ParagraphObj& rObj )
-: List()
+: std::vector<PortionObj*>()
, PropStateValue()
, SOParagraph()
{
@@ -718,14 +718,14 @@ ParagraphObj::~ParagraphObj()
void ParagraphObj::Write( SvStream* pStrm )
{
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- ((PortionObj*)pPtr)->Write( pStrm, mbLastParagraph );
+ for ( const_iterator it = begin(); it != end(); ++it )
+ (*it)->Write( pStrm, mbLastParagraph );
}
void ParagraphObj::ImplClear()
{
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- delete (PortionObj*)pPtr;
+ for ( const_iterator it = begin(); it != end(); ++it )
+ delete *it;
}
void ParagraphObj::CalculateGraphicBulletSize( sal_uInt16 nFontHeight )
@@ -884,7 +884,7 @@ void ParagraphObj::ImplGetNumberingLevel( PPTExBulletProvider& rBuProv, sal_Int1
}
}
- PortionObj* pPortion = (PortionObj*)First();
+ PortionObj* pPortion = front();
CalculateGraphicBulletSize( ( pPortion ) ? pPortion->mnCharHeight : 24 );
switch( (SvxExtNumType)nNumberingType )
@@ -1145,11 +1145,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj )
mbForbiddenRules = rParagraphObj.mbForbiddenRules;
mnBiDi = rParagraphObj.mnBiDi;
- {
- ParagraphObj& rConstApiLossage = const_cast<ParagraphObj&>(rParagraphObj);
- for ( const void* pPtr = rConstApiLossage.First(); pPtr; pPtr = rConstApiLossage.Next() )
- Insert( new PortionObj( *static_cast<const PortionObj*>(pPtr) ), LIST_APPEND );
- }
+ for ( ParagraphObj::const_iterator it = rParagraphObj.begin(); it != rParagraphObj.end(); ++it )
+ push_back( new PortionObj( **it ) );
maTabStop = rParagraphObj.maTabStop;
bExtendedParameters = rParagraphObj.bExtendedParameters;
@@ -1177,8 +1174,8 @@ void ParagraphObj::ImplConstruct( const ParagraphObj& rParagraphObj )
sal_uInt32 ParagraphObj::ImplCalculateTextPositions( sal_uInt32 nCurrentTextPosition )
{
mnTextSize = 0;
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- mnTextSize += ((PortionObj*)pPtr)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
+ for ( const_iterator it = begin(); it != end(); ++it )
+ mnTextSize += (*it)->ImplCalculateTextPositions( nCurrentTextPosition + mnTextSize );
return mnTextSize;
}
@@ -1193,20 +1190,19 @@ ParagraphObj& ParagraphObj::operator=( const ParagraphObj& rParagraphObj )
}
ImplTextObj::ImplTextObj( int nInstance )
+ : maList()
{
mnRefCount = 1;
mnTextSize = 0;
mnInstance = nInstance;
- mpList = new List;
mbHasExtendedBullets = sal_False;
mbFixedCellHeightUsed = sal_False;
}
ImplTextObj::~ImplTextObj()
{
- for ( ParagraphObj* pPtr = (ParagraphObj*)mpList->First(); pPtr; pPtr = (ParagraphObj*)mpList->Next() )
- delete pPtr;
- delete mpList;
+ for ( std::vector<ParagraphObj*>::const_iterator it = maList.begin(); it != maList.end(); ++it )
+ delete *it;
}
TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSimpleText > & rXTextRef,
@@ -1234,7 +1230,7 @@ TextObj::TextObj( ::com::sun::star::uno::Reference< ::com::sun::star::text::XSim
aParaFlags.bLastParagraph = sal_True;
ParagraphObj* pPara = new ParagraphObj( aXParagraph, aParaFlags, rFontCollection, rProv );
mpImplTextObj->mbHasExtendedBullets |= pPara->bExtendedBulletsUsed;
- mpImplTextObj->mpList->Insert( pPara, LIST_APPEND );
+ mpImplTextObj->maList.push_back( pPara );
aParaFlags.bFirstParagraph = sal_False;
}
}
@@ -1258,8 +1254,8 @@ TextObj::~TextObj()
void TextObj::ImplCalculateTextPositions()
{
mpImplTextObj->mnTextSize = 0;
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- mpImplTextObj->mnTextSize += ((ParagraphObj*)pPtr)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize );
+ for ( sal_uInt32 i = 0; i < ParagraphCount(); ++i )
+ mpImplTextObj->mnTextSize += GetParagraph(i)->ImplCalculateTextPositions( mpImplTextObj->mnTextSize );
}
TextObj& TextObj::operator=( TextObj& rTextObj )
diff --git a/sd/source/filter/eppt/text.hxx b/sd/source/filter/eppt/text.hxx
index 8f5c257..40ffa57 100644
--- a/sd/source/filter/eppt/text.hxx
+++ b/sd/source/filter/eppt/text.hxx
@@ -35,7 +35,6 @@
#include <rtl/textenc.h>
#include <com/sun/star/awt/FontDescriptor.hpp>
#include <com/sun/star/lang/Locale.hpp>
-#include <tools/list.hxx>
namespace com { namespace sun { namespace star {
namespace awt { struct FontDescriptor; }
@@ -169,7 +168,7 @@ struct ParaFlags
ParaFlags() { bFirstParagraph = sal_True; bLastParagraph = sal_False; };
};
-class ParagraphObj : public List, public PropStateValue, public SOParagraph
+class ParagraphObj : public std::vector<PortionObj*>, public PropStateValue, public SOParagraph
{
friend class TextObj;
friend struct PPTExParaSheet;
@@ -234,7 +233,7 @@ struct ImplTextObj
sal_uInt32 mnRefCount;
sal_uInt32 mnTextSize;
int mnInstance;
- List* mpList;
+ std::vector<ParagraphObj*> maList;
sal_Bool mbHasExtendedBullets;
sal_Bool mbFixedCellHeightUsed;
@@ -253,8 +252,8 @@ class TextObj
TextObj( const TextObj& rTextObj );
~TextObj();
- ParagraphObj* First(){ return (ParagraphObj*)mpImplTextObj->mpList->First(); };
- ParagraphObj* Next(){ return(ParagraphObj*)mpImplTextObj->mpList->Next(); };
+ ParagraphObj* GetParagraph(int idx) { return mpImplTextObj->maList[idx]; };
+ sal_uInt32 ParagraphCount() const { return mpImplTextObj->maList.size(); };
sal_uInt32 Count() const { return mpImplTextObj->mnTextSize; };
int GetInstance() const { return mpImplTextObj->mnInstance; };
sal_Bool HasExtendedBullets(){ return mpImplTextObj->mbHasExtendedBullets; };
commit d037459ca5da62f0ae02a2796c661d41427e67ef
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Aug 13 22:00:17 2012 +0200
PPTParagraphObj: replace PPTPortionObj array with boost::ptr_vector
Remove null pointer checks as well, we've been dereferencing them
always since c21c2f82f9451c293c449e4647522d126a0f2bee (2001) already.
Change-Id: I978745ab922f7975a785857f7d17add62e37baba
diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index 1940e67..b8d5454 100644
--- a/filter/inc/filter/msfilter/svdfppt.hxx
+++ b/filter/inc/filter/msfilter/svdfppt.hxx
@@ -46,6 +46,7 @@
#include <vcl/font.hxx>
#include <vector>
#include <boost/optional.hpp>
+#include <boost/ptr_container/ptr_vector.hpp>
class SdrModel;
class SdPage;
@@ -1100,7 +1101,7 @@ class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet
public:
- sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
+ sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const;
SvxFieldItem* GetTextField();
PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth );
@@ -1149,8 +1150,7 @@ public:
sal_Bool mbTab; // if true, this paragraph has tabulators in text
sal_uInt32 mnCurrentObject;
- sal_uInt32 mnPortionCount;
- PPTPortionObj** mpPortionList;
+ ::boost::ptr_vector<PPTPortionObj> m_PortionList;
void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const;
sal_Bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet );
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 06082c2..da00296 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5284,7 +5284,7 @@ sal_Bool PPTPortionObj::HasTabulator()
return bRetValue;
}
-sal_Bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sal_uInt32 nDestinationInstance )
+sal_Bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sal_uInt32 nDestinationInstance ) const
{
sal_uInt32 nMask = 1 << nAttr;
nRetValue = 0;
@@ -5622,9 +5622,7 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 n
PPTNumberFormatCreator ( NULL ),
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
- mbTab ( sal_True ), // style sheets always have to get the right tabulator setting
- mnPortionCount ( 0 ),
- mpPortionList ( NULL )
+ mbTab ( sal_True ) // style sheets always have to get the right tabulator setting
{
if ( nDepth > 4 )
nDepth = 4;
@@ -5641,36 +5639,26 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
mbTab ( sal_False ),
- mnCurrentObject ( 0 ),
- mnPortionCount ( 0 ),
- mpPortionList ( NULL )
+ mnCurrentObject ( 0 )
{
if (rnCurCharPos < rPropReader.aCharPropList.size())
{
- PPTCharPropSet* pCharPropSet = rPropReader.aCharPropList[rnCurCharPos];
- sal_uInt32 nCurrentParagraph = pCharPropSet->mnParagraph;
- for (size_t n = rnCurCharPos;
- n < rPropReader.aCharPropList.size() && rPropReader.aCharPropList[n]->mnParagraph == nCurrentParagraph; ++n )
- mnPortionCount++; // counting number of portions that are part of this paragraph
-
- mpPortionList = new PPTPortionObj*[ mnPortionCount ];
- for ( sal_uInt32 i = 0; i < mnPortionCount; i++ )
+ sal_uInt32 const nCurrentParagraph =
+ rPropReader.aCharPropList[rnCurCharPos]->mnParagraph;
+ for (; rnCurCharPos < rPropReader.aCharPropList.size() &&
+ rPropReader.aCharPropList[rnCurCharPos]->mnParagraph == nCurrentParagraph;
+ ++rnCurCharPos)
{
- pCharPropSet = rPropReader.aCharPropList[rnCurCharPos + i];
- if ( pCharPropSet )
+ PPTCharPropSet *const pCharPropSet =
+ rPropReader.aCharPropList[rnCurCharPos];
+ PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet,
+ rStyleSheet, nInstance, pParaSet->mnDepth );
+ m_PortionList.push_back(pPPTPortion);
+ if (!mbTab)
{
- PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet, rStyleSheet, nInstance, pParaSet->mnDepth );
- mpPortionList[ i ] = pPPTPortion;
- if ( !mbTab )
- mbTab = mpPortionList[ i ]->HasTabulator();
- }
- else
- {
- OSL_FAIL( "SJ:PPTParagraphObj::It seems that there are missing some textportions" );
- mpPortionList[ i ] = NULL;
+ mbTab = pPPTPortion->HasTabulator();
}
}
- rnCurCharPos += mnPortionCount;
}
}
@@ -5681,15 +5669,11 @@ PPTParagraphObj::~PPTParagraphObj()
void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion )
{
- sal_uInt32 i;
- PPTPortionObj** mpOldPortionList = mpPortionList;
- mpPortionList = new PPTPortionObj*[ ++mnPortionCount ];
- for ( i = 0; i < mnPortionCount - 1; i++ )
- mpPortionList[ i ] = mpOldPortionList[ i ];
- delete[] mpOldPortionList;
- mpPortionList[ mnPortionCount - 1 ] = new PPTPortionObj( rPPTPortion );
+ m_PortionList.push_back(new PPTPortionObj(rPPTPortion));
if ( !mbTab )
- mbTab = mpPortionList[ mnPortionCount - 1 ]->HasTabulator();
+ {
+ mbTab = m_PortionList.back().HasTabulator();
+ }
}
void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
@@ -5697,11 +5681,13 @@ void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
if ( nBulletRelSize > 0x7fff ) // a negative value is the absolute bullet height
{
sal_uInt16 nFontHeight = 0;
- if ( mpPortionList )
+ if (!m_PortionList.empty())
{
- PPTPortionObj* pPortion = mpPortionList[ 0 ];
- if ( pPortion && ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_FontHeight ) ) )
- nFontHeight = pPortion->pCharSet->mnFontHeight;
+ PPTPortionObj const& rPortion = m_PortionList.front();
+ if (rPortion.pCharSet->mnAttrSet & (1 << PPT_CharAttr_FontHeight))
+ {
+ nFontHeight = rPortion.pCharSet->mnFontHeight;
+ }
}
// if we do not have a hard attributed fontheight, the fontheight is taken from the style
if ( !nFontHeight )
@@ -5738,15 +5724,16 @@ sal_Bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sa
else
{
nRetValue = PPT_COLSCHEME_TEXT_UND_ZEILEN;
- if ( ( nDestinationInstance != 0xffffffff ) && mnPortionCount )
+ if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty())
{
- PPTPortionObj* pPortion = mpPortionList[ 0 ];
- if ( pPortion )
+ PPTPortionObj const& rPortion = m_PortionList.front();
+ if (rPortion.pCharSet->mnAttrSet & (1 << PPT_CharAttr_FontColor))
{
- if ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_FontColor ) )
- nRetValue = pPortion->pCharSet->mnColor;
- else
- nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor;
+ nRetValue = rPortion.pCharSet->mnColor;
+ }
+ else
+ {
+ nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontColor;
}
}
}
@@ -5765,15 +5752,16 @@ sal_Bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sa
{
// it is the font used which assigned to the first character of the following text
nRetValue = 0;
- if ( ( nDestinationInstance != 0xffffffff ) && mnPortionCount )
+ if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty())
{
- PPTPortionObj* pPortion = mpPortionList[ 0 ];
- if ( pPortion )
+ PPTPortionObj const& rPortion = m_PortionList.front();
+ if (rPortion.pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) )
{
- if ( pPortion->pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) )
- nRetValue = pPortion->pCharSet->mnFont;
- else
- nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont;
+ nRetValue = rPortion.pCharSet->mnFont;
+ }
+ else
+ {
+ nRetValue = mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFont;
}
}
}
@@ -5830,11 +5818,11 @@ sal_Bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sa
}
else
{
- if ( mnPortionCount )
+ if (!m_PortionList.empty())
{
- PPTPortionObj* pPortion = mpPortionList[ 0 ];
- if ( pPortion )
- bIsHardAttribute = pPortion->GetAttrib( PPT_CharAttr_Font, nRetValue, nDestinationInstance );
+ PPTPortionObj const& rPortion = m_PortionList.front();
+ bIsHardAttribute = rPortion.GetAttrib(
+ PPT_CharAttr_Font, nRetValue, nDestinationInstance);
}
else
{
@@ -5866,11 +5854,11 @@ sal_Bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& nRetValue, sa
}
else
{
- if ( mnPortionCount )
+ if (!m_PortionList.empty())
{
- PPTPortionObj* pPortion = mpPortionList[ 0 ];
- if ( pPortion )
- bIsHardAttribute = pPortion->GetAttrib( PPT_CharAttr_FontColor, nRetValue, nDestinationInstance );
+ PPTPortionObj const& rPortion = m_PortionList.front();
+ bIsHardAttribute = rPortion.GetAttrib(
+ PPT_CharAttr_FontColor, nRetValue, nDestinationInstance);
}
else
{
@@ -6088,10 +6076,11 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
(sal_uInt32)GetAttrib( PPT_ParaAttr_LowerDist, nLowerDist, nDestinationInstance ) ) != 0;
if ( ( nUpperDist > 0 ) || ( nLowerDist > 0 ) )
{
- if ( mnPortionCount )
+ if (!m_PortionList.empty())
{
sal_uInt32 nFontHeight = 0;
- mpPortionList[ mnPortionCount - 1 ]->GetAttrib( PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance );
+ m_PortionList.back().GetAttrib(
+ PPT_CharAttr_FontHeight, nFontHeight, nDestinationInstance);
if ( ((sal_Int16)nUpperDist) > 0 )
nUpperDist = - (sal_Int16)( ( nFontHeight * nUpperDist * 100 ) / 1000 );
if ( ((sal_Int16)nLowerDist) > 0 )
@@ -6168,11 +6157,11 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
sal_uInt32 PPTParagraphObj::GetTextSize()
{
sal_uInt32 nCount, nRetValue = 0;
- for ( sal_uInt32 i = 0; i < mnPortionCount; i++ )
+ for (size_t i = 0; i < m_PortionList.size(); i++)
{
- PPTPortionObj* pPortionObj = mpPortionList[ i ];
- nCount = pPortionObj->Count();
- if ( ( !nCount ) && pPortionObj->mpFieldItem )
+ PPTPortionObj const& rPortionObj = m_PortionList[i];
+ nCount = rPortionObj.Count();
+ if ((!nCount) && rPortionObj.mpFieldItem)
nCount++;
nRetValue += nCount;
}
@@ -6182,25 +6171,22 @@ sal_uInt32 PPTParagraphObj::GetTextSize()
PPTPortionObj* PPTParagraphObj::First()
{
mnCurrentObject = 0;
- if ( !mnPortionCount )
+ if (m_PortionList.empty())
return NULL;
- return mpPortionList[ 0 ];
+ return &m_PortionList.front();
}
PPTPortionObj* PPTParagraphObj::Next()
{
sal_uInt32 i = mnCurrentObject + 1;
- if ( i >= mnPortionCount )
+ if (i >= m_PortionList.size())
return NULL;
mnCurrentObject++;
- return mpPortionList[ i ];
+ return &m_PortionList[i];
}
void PPTParagraphObj::ImplClear()
{
- for ( void* pPtr = First(); pPtr; pPtr = Next() )
- delete (PPTPortionObj*)pPtr;
- delete[] mpPortionList;
}
PPTFieldEntry::~PPTFieldEntry()
commit 3a085e0b7e9249310edffeabe1c48b06b9d1fae0
Author: Michael Stahl <mstahl at redhat.com>
Date: Mon Aug 13 21:07:18 2012 +0200
PPTParagraphObj: fix problems in previous commit:
- check for a null List element is actually check for valid index
- there may be any number of character properties for every paragraph,
so need to pass in 2 parameters to PPTParagraphObj ctor
- PPTTextObj::PPTTextObj: nIdx became n in one place
- PPTTextObj::PPTTextObj: n++ dropped in one place
Change-Id: I590834012c46b7885ba5aa9c50655bf62439a0e9
diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index 4693ff6..1940e67 100644
--- a/filter/inc/filter/msfilter/svdfppt.hxx
+++ b/filter/inc/filter/msfilter/svdfppt.hxx
@@ -1162,7 +1162,8 @@ public:
);
PPTParagraphObj(
PPTStyleTextPropReader&,
- sal_uInt32 nCurPos,
+ size_t nCurParaPos,
+ size_t& rnCurCharPos,
const PPTStyleSheet&,
sal_uInt32 nInstance,
PPTTextRulerInterpreter& rRuler
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 22f176e..06082c2 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5631,9 +5631,11 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 n
pParaSet->mnDepth = nDepth;
}
-PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, sal_uInt32 nCurPos, const PPTStyleSheet& rStyleSheet,
+PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
+ size_t const nCurParaPos, size_t& rnCurCharPos,
+ const PPTStyleSheet& rStyleSheet,
sal_uInt32 nInstance, PPTTextRulerInterpreter& rRuler ) :
- PPTParaPropSet ( *rPropReader.aParaPropList[nCurPos] ),
+ PPTParaPropSet ( *rPropReader.aParaPropList[nCurParaPos] ),
PPTNumberFormatCreator ( NULL ),
PPTTextRulerInterpreter ( rRuler ),
mrStyleSheet ( rStyleSheet ),
@@ -5643,18 +5645,18 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, sal_uInt3
mnPortionCount ( 0 ),
mpPortionList ( NULL )
{
- PPTCharPropSet* pCharPropSet = rPropReader.aCharPropList[nCurPos];
- if ( pCharPropSet )
+ if (rnCurCharPos < rPropReader.aCharPropList.size())
{
+ PPTCharPropSet* pCharPropSet = rPropReader.aCharPropList[rnCurCharPos];
sal_uInt32 nCurrentParagraph = pCharPropSet->mnParagraph;
- for ( sal_uInt32 n = nCurPos;
+ for (size_t n = rnCurCharPos;
n < rPropReader.aCharPropList.size() && rPropReader.aCharPropList[n]->mnParagraph == nCurrentParagraph; ++n )
mnPortionCount++; // counting number of portions that are part of this paragraph
mpPortionList = new PPTPortionObj*[ mnPortionCount ];
for ( sal_uInt32 i = 0; i < mnPortionCount; i++ )
{
- pCharPropSet = rPropReader.aCharPropList[ nCurPos + i ];
+ pCharPropSet = rPropReader.aCharPropList[rnCurCharPos + i];
if ( pCharPropSet )
{
PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet, rStyleSheet, nInstance, pParaSet->mnDepth );
@@ -5668,6 +5670,7 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, sal_uInt3
mpPortionList[ i ] = NULL;
}
}
+ rnCurCharPos += mnPortionCount;
}
}
@@ -6838,7 +6841,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pCurrent );
pNewCPS->maString = String( pCurrent->maString, (sal_uInt16)nHyperLenLeft, (sal_uInt16)( nNextStringLen - nHyperLenLeft ) );
- aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
+ aCharPropList.insert( aCharPropList.begin() + nIdx + 1, pNewCPS );
String aRepresentation( pCurrent->maString, 0, (sal_uInt16)nHyperLenLeft );
pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
nHyperLenLeft = 0;
@@ -6854,7 +6857,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
pBefCPS->maString = String( aString, (sal_uInt16)0, (sal_uInt16)nCount );
aCharPropList.insert( aCharPropList.begin() + n, pBefCPS );
-
+ n++;
}
}
}
@@ -6869,9 +6872,14 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
}
}
mpImplTextObj->mpParagraphList = new PPTParagraphObj*[ nParagraphs ];
- for ( sal_uInt32 nCurPos = 0; nCurPos < aStyleTextPropReader.aParaPropList.size(); ++nCurPos )
+ for (size_t nCurCharPos = 0, nCurPos = 0;
+ nCurPos < aStyleTextPropReader.aParaPropList.size();
+ ++nCurPos)
{
- PPTParagraphObj* pPara = new PPTParagraphObj( aStyleTextPropReader, nCurPos, *rSdrPowerPointImport.pPPTStyleSheet, nInstance, aTextRulerInterpreter );
+ PPTParagraphObj* pPara = new PPTParagraphObj(
+ aStyleTextPropReader, nCurPos, nCurCharPos,
+ *rSdrPowerPointImport.pPPTStyleSheet,
+ nInstance, aTextRulerInterpreter );
mpImplTextObj->mpParagraphList[ nCurPos ] = pPara;
sal_uInt32 nParaAdjust, nFlags = 0;
commit 03ec685a0839482995bf8815a1528ee15d2afe3c
Author: Noel Grandin <noel at peralex.com>
Date: Wed Aug 8 14:52:00 2012 +0200
Convert property lists from tools/list.hxx to std::vector
Change-Id: I447883a8bbfa01ef60e7ad870c0f9ddefb7fdada
diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index c559a82..4693ff6 100644
--- a/filter/inc/filter/msfilter/svdfppt.hxx
+++ b/filter/inc/filter/msfilter/svdfppt.hxx
@@ -33,7 +33,6 @@
#include <tools/string.hxx>
#include <tools/gen.hxx>
#include <tools/color.hxx>
-#include <tools/list.hxx>
#include <svx/svdobj.hxx>
#include <editeng/numitem.hxx>
#include <editeng/editdata.hxx>
@@ -1037,11 +1036,14 @@ struct StyleTextProp9
void Read( SvStream& rSt );
};
+typedef std::vector<PPTParaPropSet*> PPTParaPropSetList;
+typedef std::vector<PPTCharPropSet*> PPTCharPropSetList;
+
struct PPTStyleTextPropReader
{
- ::std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
- List aParaPropList;
- List aCharPropList;
+ std::vector< sal_uInt32 > aSpecMarkerList; // hiword -> Flags, loword -> Position
+ PPTParaPropSetList aParaPropList;
+ PPTCharPropSetList aCharPropList;
PPTStyleTextPropReader(
SvStream& rIn,
@@ -1160,6 +1162,7 @@ public:
);
PPTParagraphObj(
PPTStyleTextPropReader&,
+ sal_uInt32 nCurPos,
const PPTStyleSheet&,
sal_uInt32 nInstance,
PPTTextRulerInterpreter& rRuler
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index c94c132..22f176e 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -4881,7 +4881,7 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport&
}
PPTParaPropSet* pPara = new PPTParaPropSet( aParaPropSet );
pPara->mnOriginalTextPos = nCharAnzRead;
- aParaPropList.Insert( pPara, LIST_APPEND );
+ aParaPropList.push_back( pPara );
if ( nCharCount )
{
sal_uInt32 nCount;
@@ -4892,7 +4892,7 @@ void PPTStyleTextPropReader::ReadParaProps( SvStream& rIn, SdrPowerPointImport&
{
pPara = new PPTParaPropSet( aParaPropSet );
pPara->mnOriginalTextPos = nCharAnzRead + nCount + 1;
- aParaPropList.Insert( pPara, LIST_APPEND );
+ aParaPropList.push_back( pPara );
}
}
}
@@ -5102,8 +5102,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
bTextPropAtom, nExtParaPos, aStyleTextProp9, nExtParaFlags,
nBuBlip, nHasAnm, nAnmScheme );
- aCharPropList.Insert(
- new PPTCharPropSet( aCharPropSet, 0 ), LIST_APPEND );
+ aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, 0 ) );
}
}
@@ -5137,9 +5136,9 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
sal_uInt32 nLen;
while( nCharCount )
{
- if ( nExtParaPos && ( nLatestParaUpdate != nCurrentPara ) && ( nCurrentPara < aParaPropList.Count() ) )
+ if ( nExtParaPos && ( nLatestParaUpdate != nCurrentPara ) && ( nCurrentPara < aParaPropList.size() ) )
{
- PPTParaPropSet* pPropSet = (PPTParaPropSet*)aParaPropList.GetObject( nCurrentPara );
+ PPTParaPropSet* pPropSet = aParaPropList[ nCurrentPara ];
pPropSet->pParaSet->mnExtParagraphMask = nExtParaFlags;
if ( nExtParaFlags & 0x800000 )
pPropSet->pParaSet->mnBuBlip = nBuBlip;
@@ -5160,7 +5159,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
else if ( bEmptyParaPossible )
aCharPropSet.maString = String();
if ( nLen || bEmptyParaPossible )
- aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
nCurrentPara++;
nLen++;
nCharAnzRead += nLen;
@@ -5173,7 +5172,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
{
nLen = ( nCurrentSpecMarker & 0xffff ) - nCharAnzRead;
aCharPropSet.maString = String( aString, (sal_uInt16)nCharAnzRead, (sal_uInt16)nLen );
- aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
nCharCount -= nLen;
nCharAnzRead += nLen;
}
@@ -5181,7 +5180,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
pCPropSet->maString = aString.GetChar( (sal_uInt16)nCharAnzRead );
if ( aCharPropSet.pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Symbol ) )
pCPropSet->SetFont( aCharPropSet.pCharSet->mnSymbolFont );
- aCharPropList.Insert( pCPropSet, LIST_APPEND );
+ aCharPropList.push_back( pCPropSet );
nCharCount--;
nCharAnzRead++;
bEmptyParaPossible = sal_False;
@@ -5191,19 +5190,19 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
else
{
aCharPropSet.maString = String( aString, (sal_uInt16)nCharAnzRead, (sal_uInt16)nCharCount );
- aCharPropList.Insert( new PPTCharPropSet( aCharPropSet, nCurrentPara ), LIST_APPEND );
+ aCharPropList.push_back( new PPTCharPropSet( aCharPropSet, nCurrentPara ) );
nCharAnzRead += nCharCount;
bEmptyParaPossible = sal_False;
break;
}
}
}
- if ( aCharPropList.Count() && ( ((PPTCharPropSet*)aCharPropList.Last())->mnParagraph != nCurrentPara ) )
+ if ( !aCharPropList.empty() && ( aCharPropList.back()->mnParagraph != nCurrentPara ) )
{
- PPTCharPropSet* pCharPropSet = new PPTCharPropSet( *(PPTCharPropSet*)aCharPropList.Last(), nCurrentPara );
+ PPTCharPropSet* pCharPropSet = new PPTCharPropSet( *aCharPropList.back(), nCurrentPara );
pCharPropSet->maString = String();
pCharPropSet->mnOriginalTextPos = nStringLen - 1;
- aCharPropList.Insert( pCharPropSet, LIST_APPEND );
+ aCharPropList.push_back( pCharPropSet );
}
}
rIn.Seek( nMerk );
@@ -5211,11 +5210,10 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, SdrPowerPointImport& rMan, con
PPTStyleTextPropReader::~PPTStyleTextPropReader()
{
- void* pTmp;
- for ( pTmp = aParaPropList.First(); pTmp; pTmp = aParaPropList.Next() )
- delete (PPTParaPropSet*)pTmp;
- for ( pTmp = aCharPropList.First(); pTmp; pTmp = aCharPropList.Next() )
- delete (PPTCharPropSet*)pTmp;
+ for ( PPTParaPropSetList::const_iterator it = aParaPropList.begin(); it != aParaPropList.end(); ++it )
+ delete *it;
+ for ( PPTCharPropSetList::const_iterator it = aCharPropList.begin(); it != aCharPropList.end(); ++it )
+ delete *it;
}
struct FieldEntry
@@ -5633,9 +5631,9 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 n
pParaSet->mnDepth = nDepth;
}
-PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPTStyleSheet& rStyleSheet,
+PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, sal_uInt32 nCurPos, const PPTStyleSheet& rStyleSheet,
sal_uInt32 nInstance, PPTTextRulerInterpreter& rRuler ) :
- PPTParaPropSet ( *( (PPTParaPropSet*)rPropReader.aParaPropList.GetCurObject() ) ),
+ PPTParaPropSet ( *rPropReader.aParaPropList[nCurPos] ),
PPTNumberFormatCreator ( NULL ),
PPTTextRulerInterpreter ( rRuler ),
mrStyleSheet ( rStyleSheet ),
@@ -5645,18 +5643,18 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPT
mnPortionCount ( 0 ),
mpPortionList ( NULL )
{
- sal_uInt32 nCurPos = rPropReader.aCharPropList.GetCurPos();
- PPTCharPropSet* pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.GetCurObject();
+ PPTCharPropSet* pCharPropSet = rPropReader.aCharPropList[nCurPos];
if ( pCharPropSet )
{
sal_uInt32 nCurrentParagraph = pCharPropSet->mnParagraph;
- for ( ; pCharPropSet && ( pCharPropSet->mnParagraph == nCurrentParagraph ); pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next() )
+ for ( sal_uInt32 n = nCurPos;
+ n < rPropReader.aCharPropList.size() && rPropReader.aCharPropList[n]->mnParagraph == nCurrentParagraph; ++n )
mnPortionCount++; // counting number of portions that are part of this paragraph
- pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Seek( nCurPos );
mpPortionList = new PPTPortionObj*[ mnPortionCount ];
for ( sal_uInt32 i = 0; i < mnPortionCount; i++ )
{
+ pCharPropSet = rPropReader.aCharPropList[ nCurPos + i ];
if ( pCharPropSet )
{
PPTPortionObj* pPPTPortion = new PPTPortionObj( *pCharPropSet, rStyleSheet, nInstance, pParaSet->mnDepth );
@@ -5669,7 +5667,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, const PPT
OSL_FAIL( "SJ:PPTParagraphObj::It seems that there are missing some textportions" );
mpPortionList[ i ] = NULL;
}
- pCharPropSet = (PPTCharPropSet*)rPropReader.aCharPropList.Next();
}
}
}
@@ -6471,7 +6468,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
PPTStyleTextPropReader aStyleTextPropReader( rIn, rSdrPowerPointImport, aClientTextBoxHd,
aTextRulerInterpreter, aExtParaHd, nInstance );
- sal_uInt32 nParagraphs = mpImplTextObj->mnParagraphCount = aStyleTextPropReader.aParaPropList.Count();
+ sal_uInt32 nParagraphs = mpImplTextObj->mnParagraphCount = aStyleTextPropReader.aParaPropList.size();
if ( nParagraphs )
{
// the language settings will be merged into the list of PPTCharPropSet
@@ -6491,9 +6488,9 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
sal_uInt32 nCharIdx = pSpecInfo->nCharIdx;
// portions and text have to been splitted in some cases
- for ( ; nI < aStyleTextPropReader.aCharPropList.Count(); )
+ for ( ; nI < aStyleTextPropReader.aCharPropList.size(); )
{
- PPTCharPropSet* pSet = (PPTCharPropSet*)aStyleTextPropReader.aCharPropList.GetObject( nI );
+ PPTCharPropSet* pSet = aStyleTextPropReader.aCharPropList[ nI ];
if ( pSet->mnOriginalTextPos < nCharIdx )
{
pSet->mnLanguage[ 0 ] = pSpecInfo->nLanguage[ 0 ];
@@ -6513,7 +6510,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
pSet->maString = String( aString, 0, (sal_uInt16)nOldLen );
pNew->maString = String( aString, (sal_uInt16)nOldLen, (sal_uInt16)nNewLen );
pNew->mnOriginalTextPos += nOldLen;
- aStyleTextPropReader.aCharPropList.Insert( pNew, nI + 1 );
+ aStyleTextPropReader.aCharPropList.insert( aStyleTextPropReader.aCharPropList.begin() + nI + 1, pNew );
}
}
}
@@ -6725,16 +6722,16 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if ( !FieldList.empty() )
{
::std::vector< PPTFieldEntry* >::iterator FE = FieldList.begin();
- List& aCharPropList = aStyleTextPropReader.aCharPropList;
+ PPTCharPropSetList& aCharPropList = aStyleTextPropReader.aCharPropList;
sal_Int32 i = nParagraphs - 1;
- sal_Int32 n = aCharPropList.Count() - 1;
+ sal_Int32 n = aCharPropList.size() - 1;
// at this point we just have a list of textportions(aCharPropList)
// the next while loop tries to resolve the list of fields(pFieldList)
while( ( FE < FieldList.end() ) && ( n >= 0 ) && ( i >= 0 ) )
{
- PPTCharPropSet* pSet = (PPTCharPropSet*)aCharPropList.GetObject( n );
+ PPTCharPropSet* pSet = aCharPropList[n];
String aString( pSet->maString );
sal_uInt32 nCount = aString.Len();
sal_uInt32 nPos = pSet->mnOriginalTextPos + nCount;
@@ -6756,23 +6753,23 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
pNewCPS->maString = String( aString, (sal_uInt16)nCount + 1, (sal_uInt16)nBehind );
- aCharPropList.Insert( pNewCPS, n + 1 );
+ aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
}
if ( (*FE)->pField2 )
{
PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
pNewCPS->mpFieldItem = (*FE)->pField2, (*FE)->pField2 = NULL;
- aCharPropList.Insert( pNewCPS, n + 1 );
+ aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
pNewCPS = new PPTCharPropSet( *pSet );
pNewCPS->maString = String( String( RTL_CONSTASCII_USTRINGPARAM( " " ) ) );
- aCharPropList.Insert( pNewCPS, n + 1 );
+ aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
}
if ( nCount )
{
PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pSet );
pNewCPS->maString = String( aString, (sal_uInt16)0, (sal_uInt16)nCount );
- aCharPropList.Insert( pNewCPS, n++ );
+ aCharPropList.insert( aCharPropList.begin() + n++, pNewCPS );
}
if ( (*FE)->pField1 )
{
@@ -6797,12 +6794,12 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
sal_uInt32 nIdx = n;
sal_Int32 nHyperLenLeft = nHyperLen;
- while ( ( aCharPropList.Count() > nIdx ) && nHyperLenLeft )
+ while ( ( aCharPropList.size() > nIdx ) && nHyperLenLeft )
{
// the textrange hyperlink can take more than 1 paragraph
// the solution here is to clone the hyperlink...
- PPTCharPropSet* pCurrent = (PPTCharPropSet*)aCharPropList.GetObject( nIdx );
+ PPTCharPropSet* pCurrent = aCharPropList[ nIdx ];
sal_Int32 nNextStringLen = pCurrent->maString.Len();
DBG_ASSERT( (*FE)->pField1, "missing field!" );
@@ -6829,9 +6826,9 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
// if the next portion is in a higher paragraph,
// the textrange is to decrease (because of the LineBreak character)
- if ( aCharPropList.Count() > ( nIdx + 1 ) )
+ if ( aCharPropList.size() > ( nIdx + 1 ) )
{
- PPTCharPropSet* pNext = (PPTCharPropSet*)aCharPropList.GetObject( nIdx + 1 );
+ PPTCharPropSet* pNext = aCharPropList[ nIdx + 1 ];
if ( pNext->mnParagraph > pCurrent->mnParagraph )
nHyperLenLeft--;
}
@@ -6841,7 +6838,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
{
PPTCharPropSet* pNewCPS = new PPTCharPropSet( *pCurrent );
pNewCPS->maString = String( pCurrent->maString, (sal_uInt16)nHyperLenLeft, (sal_uInt16)( nNextStringLen - nHyperLenLeft ) );
- aCharPropList.Insert( pNewCPS, nIdx + 1 );
+ aCharPropList.insert( aCharPropList.begin() + n + 1, pNewCPS );
String aRepresentation( pCurrent->maString, 0, (sal_uInt16)nHyperLenLeft );
pCurrent->mpFieldItem = new SvxFieldItem( SvxURLField( pField->GetURL(), aRepresentation, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD );
nHyperLenLeft = 0;
@@ -6856,7 +6853,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
if ( pBefCPS )
{
pBefCPS->maString = String( aString, (sal_uInt16)0, (sal_uInt16)nCount );
- aCharPropList.Insert( pBefCPS, n++ );
+ aCharPropList.insert( aCharPropList.begin() + n, pBefCPS );
}
}
@@ -6872,14 +6869,10 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport
}
}
mpImplTextObj->mpParagraphList = new PPTParagraphObj*[ nParagraphs ];
- aStyleTextPropReader.aCharPropList.First();
- sal_uInt32 nCount = 0;
- for ( void* pPtr = aStyleTextPropReader.aParaPropList.First();
- pPtr;
- pPtr = aStyleTextPropReader.aParaPropList.Next() )
+ for ( sal_uInt32 nCurPos = 0; nCurPos < aStyleTextPropReader.aParaPropList.size(); ++nCurPos )
{
- PPTParagraphObj* pPara = new PPTParagraphObj( aStyleTextPropReader, *rSdrPowerPointImport.pPPTStyleSheet, nInstance, aTextRulerInterpreter );
- mpImplTextObj->mpParagraphList[ nCount++ ] = pPara;
+ PPTParagraphObj* pPara = new PPTParagraphObj( aStyleTextPropReader, nCurPos, *rSdrPowerPointImport.pPPTStyleSheet, nInstance, aTextRulerInterpreter );
+ mpImplTextObj->mpParagraphList[ nCurPos ] = pPara;
sal_uInt32 nParaAdjust, nFlags = 0;
pPara->GetAttrib( PPT_ParaAttr_Adjust, nParaAdjust, GetInstance() );
commit 07f4263cdec47be554da18cc37d2078d170c5ec3
Author: Noel Grandin <noel at peralex.com>
Date: Mon Aug 13 12:34:20 2012 +0200
Move definition of LIST_APPEND to contnr.hxx
This definition is used everywhere as a flag value, even where
the List class itself is not used. Move it as part of stripping
away usage of the List class.
Change-Id: I064dc25368bd04b038f4e07a337bf8adf0b8d0eb
diff --git a/tools/inc/tools/contnr.hxx b/tools/inc/tools/contnr.hxx
index 72b98fd..cfd140d 100644
--- a/tools/inc/tools/contnr.hxx
+++ b/tools/inc/tools/contnr.hxx
@@ -35,6 +35,8 @@ class CBlock;
#define CONTAINER_APPEND ULONG_MAX
#define CONTAINER_ENTRY_NOTFOUND ULONG_MAX
+#define LIST_APPEND CONTAINER_APPEND
+
class TOOLS_DLLPUBLIC Container
{
private:
diff --git a/tools/inc/tools/list.hxx b/tools/inc/tools/list.hxx
index d7a4e0e..b462d55 100644
--- a/tools/inc/tools/list.hxx
+++ b/tools/inc/tools/list.hxx
@@ -27,7 +27,6 @@
// - List -
// --------
-#define LIST_APPEND CONTAINER_APPEND
#define LIST_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
class List : private Container
More information about the Libreoffice-commits
mailing list