summaryrefslogtreecommitdiff
path: root/filter/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-18 12:47:02 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-04-07 09:00:35 +0000
commit6c401a7bdc4e0f5340203b9885e368cb96986aa1 (patch)
treec88619c929578f2b3f74e305f1ad5192295196bb /filter/source
parent7b9f22fb62cddcc48866c3abae1ad1f636548dde (diff)
ofz#893 limit para depth to max legal ppt level
Change-Id: Ie7c287964b126d143a0eeb14be53addc7c34b87f Reviewed-on: https://gerrit.libreoffice.org/35402 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'filter/source')
-rw-r--r--filter/source/msfilter/svdfppt.cxx34
1 files changed, 20 insertions, 14 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 088b01766a26..dfd8148bf699 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5824,6 +5824,19 @@ SvxFieldItem* PPTPortionObj::GetTextField()
return nullptr;
}
+namespace
+{
+ sal_uInt16 sanitizeForMaxPPTLevels(sal_uInt16 nDepth)
+ {
+ if (nDepth >= nMaxPPTLevels)
+ {
+ SAL_WARN("filter.ms", "Para Style Sheet depth " << nDepth << " but " << nMaxPPTLevels - 1 << " is max possible");
+ nDepth = nMaxPPTLevels - 1;
+ }
+ return nDepth;
+ }
+}
+
PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt16 nDepth ) :
PPTNumberFormatCreator ( nullptr ),
mrStyleSheet ( rStyleSheet ),
@@ -5831,9 +5844,7 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nIn
mbTab ( true ), // style sheets always have to get the right tabulator setting
mnCurrentObject ( 0 )
{
- if ( nDepth > 4 )
- nDepth = 4;
- pParaSet->mnDepth = nDepth;
+ pParaSet->mnDepth = sanitizeForMaxPPTLevels(nDepth);
}
PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
@@ -5898,7 +5909,9 @@ void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
}
// if we do not have a hard attributed fontheight, the fontheight is taken from the style
if ( !nFontHeight )
- nFontHeight = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ pParaSet->mnDepth ].mnFontHeight;
+ {
+ nFontHeight = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[sanitizeForMaxPPTLevels(pParaSet->mnDepth)].mnFontHeight;
+ }
nBulletRelSize = nFontHeight ? ((-((sal_Int16)nBulletRelSize)) * 100 ) / nFontHeight : 100;
}
}
@@ -5916,13 +5929,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Ty
bool bIsHardAttribute = ( ( pParaSet->mnAttrSet & nMask ) != 0 );
- sal_uInt16 nDepth = pParaSet->mnDepth;
-
- if (nDepth >= nMaxPPTLevels)
- {
- SAL_WARN("filter.ms", "Para Style Sheet depth " << nDepth << " but " << nMaxPPTLevels - 1 << " is max possible");
- nDepth = nMaxPPTLevels - 1;
- }
+ sal_uInt16 nDepth = sanitizeForMaxPPTLevels(pParaSet->mnDepth);
if ( bIsHardAttribute )
{
@@ -6202,12 +6209,11 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
if ( pRule )
{
pRule->SetLevel( pParaSet->mnDepth, aNumberFormat );
- sal_uInt16 i, n;
- for ( i = 0; i < pRule->GetLevelCount(); i++ )
+ for (sal_uInt16 i = 0; i < pRule->GetLevelCount(); ++i)
{
if ( i != pParaSet->mnDepth )
{
- n = i > 4 ? 4 : i;
+ sal_uInt16 n = sanitizeForMaxPPTLevels(i);
SvxNumberFormat aNumberFormat2( pRule->GetLevel( i ) );
const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ nInstance ]->maParaLevel[ n ];