summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-08-13 21:07:18 +0200
committerMichael Stahl <mstahl@redhat.com>2012-08-13 22:48:11 +0200
commit3a085e0b7e9249310edffeabe1c48b06b9d1fae0 (patch)
treebdbe50d4a0f508e09c9bcb61c576ade4099eec8d /filter
parent03ec685a0839482995bf8815a1528ee15d2afe3c (diff)
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
Diffstat (limited to 'filter')
-rw-r--r--filter/inc/filter/msfilter/svdfppt.hxx3
-rw-r--r--filter/source/msfilter/svdfppt.cxx28
2 files changed, 20 insertions, 11 deletions
diff --git a/filter/inc/filter/msfilter/svdfppt.hxx b/filter/inc/filter/msfilter/svdfppt.hxx
index 4693ff617a21..1940e67c50e0 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 22f176eacdc1..06082c254c67 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;