diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-05-11 20:11:18 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-05-13 10:45:50 +0000 |
commit | 6312dfdc16f7da09f48628f51bb20b09dc5b7001 (patch) | |
tree | 09e5801b9f4f6c81aac50f753097f1548e7710e1 | |
parent | 96d5516429bc1846fc6cf7119590f7b05a65eef8 (diff) |
convert TSS_TYPE to scoped enum
Change-Id: Ic76d7bfcfe4015c6a02dc5989f8300e5ddde706e
Reviewed-on: https://gerrit.libreoffice.org/24896
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r-- | filter/source/msfilter/svdfppt.cxx | 309 | ||||
-rw-r--r-- | include/filter/msfilter/svdfppt.hxx | 85 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 77 |
3 files changed, 242 insertions, 229 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index ed227e083616..ecfacfc99f0a 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -118,6 +118,7 @@ #include <com/sun/star/table/BorderLineStyle.hpp> #include <vcl/virdev.hxx> #include <svtools/embedhlp.hxx> +#include <o3tl/enumrange.hxx> #include <algorithm> #include <cassert> @@ -979,17 +980,17 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) ) { - aTextObj.SetInstance( 2 ); + aTextObj.SetInstance( TSS_Type::Notes ); eTextKind = OBJ_TITLETEXT; } else if ( ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::MASTERNOTESBODYIMAGE ) || ( aPlaceholderAtom.nPlaceholderId == PptPlaceholder::NOTESBODY ) ) { - aTextObj.SetInstance( 2 ); + aTextObj.SetInstance( TSS_Type::Notes ); eTextKind = OBJ_TEXT; } - sal_uInt32 nDestinationInstance = aTextObj.GetInstance(); + TSS_Type nDestinationInstance = aTextObj.GetInstance(); if ( rPersistEntry.ePageKind == PPT_MASTERPAGE ) { if ( !rPersistEntry.pPresentationObjects ) @@ -997,43 +998,45 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi rPersistEntry.pPresentationObjects = new sal_uInt32[ PPT_STYLESHEETENTRYS ]; memset( rPersistEntry.pPresentationObjects, 0, PPT_STYLESHEETENTRYS * 4 ); } - if ( !rPersistEntry.pPresentationObjects[ nDestinationInstance ] ) - rPersistEntry.pPresentationObjects[ nDestinationInstance ] = rObjData.rSpHd.GetRecBegFilePos(); + if ( !rPersistEntry.pPresentationObjects[ (int)nDestinationInstance ] ) + rPersistEntry.pPresentationObjects[ (int)nDestinationInstance ] = rObjData.rSpHd.GetRecBegFilePos(); } switch ( nDestinationInstance ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : + case TSS_Type::PageTitle : + case TSS_Type::Title : { if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE ) - nDestinationInstance = TSS_TYPE_TITLE; + nDestinationInstance = TSS_Type::Title; else - nDestinationInstance = TSS_TYPE_PAGETITLE; + nDestinationInstance = TSS_Type::PageTitle; } break; - case TSS_TYPE_BODY : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : - nDestinationInstance = TSS_TYPE_BODY; + case TSS_Type::Body : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : + nDestinationInstance = TSS_Type::Body; break; + default: break; } - aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance ); + aTextObj.SetDestinationInstance( nDestinationInstance ); bool bAutoFit = false; // auto-scale text into shape box switch ( aTextObj.GetInstance() ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : eTextKind = OBJ_TITLETEXT; break; - case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break; - case TSS_TYPE_BODY : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break; + case TSS_Type::PageTitle : + case TSS_Type::Title : eTextKind = OBJ_TITLETEXT; break; + case TSS_Type::Subtitle : eTextKind = OBJ_TEXT; break; + case TSS_Type::Body : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break; + default: break; } - if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE ) + if ( aTextObj.GetDestinationInstance() != TSS_Type::TextInShape ) { if ( !aTextObj.GetOEPlaceHolderAtom() || aTextObj.GetOEPlaceHolderAtom()->nPlaceholderId == PptPlaceholder::NONE ) { - aTextObj.SetDestinationInstance( TSS_TYPE_TEXT_IN_SHAPE ); + aTextObj.SetDestinationInstance( TSS_Type::TextInShape ); eTextKind = OBJ_RECT; } } @@ -2216,7 +2219,7 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* SdrTextObj* pText = pSdrText; if ( pTextObj->Count() ) { - sal_uInt32 nDestinationInstance = pTextObj->GetDestinationInstance() ; + TSS_Type nDestinationInstance = pTextObj->GetDestinationInstance() ; SdrOutliner& rOutliner = pText->ImpGetDrawOutliner(); if ( ( pText->GetObjInventor() == SdrInventor ) && ( pText->GetObjIdentifier() == OBJ_TITLETEXT ) ) // Outliner-Style for Title-Text object?!? (->of DL) rOutliner.Init( OutlinerMode::TitleObject ); // Outliner reset @@ -2605,18 +2608,19 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, sal_uIn sal_uInt32 nShapePos = 0; switch ( aTextObj.GetInstance() ) { - case TSS_TYPE_TITLE : - nShapePos = rPersist.pPresentationObjects[ TSS_TYPE_PAGETITLE ]; + case TSS_Type::Title : + nShapePos = rPersist.pPresentationObjects[ (int)TSS_Type::PageTitle ]; break; - case TSS_TYPE_PAGETITLE : - nShapePos = rPersist.pPresentationObjects[ TSS_TYPE_PAGETITLE ]; + case TSS_Type::PageTitle : + nShapePos = rPersist.pPresentationObjects[ (int)TSS_Type::PageTitle ]; break; - case TSS_TYPE_SUBTITLE : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : - case TSS_TYPE_BODY : - nShapePos = rPersist.pPresentationObjects[ TSS_TYPE_BODY ]; + case TSS_Type::Subtitle : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : + case TSS_Type::Body : + nShapePos = rPersist.pPresentationObjects[ (int)TSS_Type::Body ]; break; + default: break; } if ( nShapePos ) { @@ -3295,7 +3299,7 @@ PPTExtParaProv::PPTExtParaProv( SdrPowerPointImport& rMan, SvStream& rSt, const while ( ( rSt.GetError() == 0 ) && ( rSt.Tell() < nHdEndRecPos ) && ( i < nDepth ) ) { bStyles = true; - ReadPPTExtParaLevel( rSt, aExtParaSheet[ aHd.nRecInstance ].aExtParaLevel[ i++ ] ); + ReadPPTExtParaLevel( rSt, aExtParaSheet[ (TSS_Type)aHd.nRecInstance ].aExtParaLevel[ i++ ] ); } #ifdef DBG_UTIL if ( rSt.Tell() != aHd.GetRecEndFilePos() ) @@ -3353,10 +3357,10 @@ PPTNumberFormatCreator::~PPTNumberFormatCreator() } bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManager, - SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, sal_uInt32 nInstance, sal_uInt32 nDestinationInstance, + SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, TSS_Type nInstance, TSS_Type nDestinationInstance, boost::optional< sal_Int16 >& rStartNumbering, sal_uInt32 nFontHeight, PPTParagraphObj* pPara ) { - bool bHardAttribute = ( nDestinationInstance == 0xffffffff ); + bool bHardAttribute = ( nDestinationInstance == TSS_Type::Unknown ); sal_uInt32 nBuFlags = 0; sal_uInt16 nHasAnm = 0; @@ -3596,7 +3600,7 @@ bool PPTNumberFormatCreator::ImplGetExtNumberFormat( SdrPowerPointImport& rManag return bHardAttribute; } -void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, sal_uInt32 nInstance ) +void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, TSS_Type nInstance ) { nIsBullet = ( rParaLevel.mnBuFlags & ( 1 << PPT_ParaAttr_BulletOn ) ) != 0 ? 1 : 0; nBulletChar = rParaLevel.mnBulletChar; @@ -3613,7 +3617,7 @@ void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, Svx nBulletOfs = rParaLevel.mnBulletOfs; boost::optional< sal_Int16 > oStartNumbering; - ImplGetExtNumberFormat( rManager, rNumberFormat, nLevel, nInstance, 0xffffffff, oStartNumbering, rCharLevel.mnFontHeight, nullptr ); + ImplGetExtNumberFormat( rManager, rNumberFormat, nLevel, nInstance, TSS_Type::Unknown, oStartNumbering, rCharLevel.mnFontHeight, nullptr ); if ( ( rNumberFormat.GetNumberingType() != SVX_NUM_BITMAP ) && ( nBulletHeight > 0x7fff ) ) nBulletHeight = rCharLevel.mnFontHeight ? ((-((sal_Int16)nBulletHeight)) * 100 ) / rCharLevel.mnFontHeight : 100; ImplGetNumberFormat( rManager, rNumberFormat, nLevel ); @@ -3644,7 +3648,7 @@ void PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, Svx } bool PPTNumberFormatCreator::GetNumberFormat( SdrPowerPointImport& rManager, SvxNumberFormat& rNumberFormat, PPTParagraphObj* pParaObj, - sal_uInt32 nDestinationInstance, boost::optional< sal_Int16 >& rStartNumbering ) + TSS_Type nDestinationInstance, boost::optional< sal_Int16 >& rStartNumbering ) { sal_uInt32 nHardCount = 0; nHardCount += pParaObj->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet, nDestinationInstance ) ? 1 : 0; @@ -3736,32 +3740,33 @@ void PPTNumberFormatCreator::ImplGetNumberFormat( SdrPowerPointImport& rManager, rNumberFormat.SetFirstLineOffset( -nFirstLineOffset ); } -PPTCharSheet::PPTCharSheet( sal_uInt32 nInstance ) +PPTCharSheet::PPTCharSheet( TSS_Type nInstance ) { sal_uInt32 nColor = PPT_COLSCHEME_TEXT_UND_ZEILEN; sal_uInt16 nFontHeight(0); switch ( nInstance ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : + case TSS_Type::PageTitle : + case TSS_Type::Title : { nColor = PPT_COLSCHEME_TITELTEXT; nFontHeight = 44; } break; - case TSS_TYPE_BODY : - case TSS_TYPE_SUBTITLE : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : + case TSS_Type::Body : + case TSS_Type::Subtitle : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : nFontHeight = 32; break; - case TSS_TYPE_NOTES : + case TSS_Type::Notes : nFontHeight = 12; break; - case TSS_TYPE_UNUSED : - case TSS_TYPE_TEXT_IN_SHAPE : + case TSS_Type::Unused : + case TSS_Type::TextInShape : nFontHeight = 24; break; + default: break; } for (PPTCharLevel & nDepth : maCharLevel) { @@ -3827,7 +3832,7 @@ void PPTCharSheet::Read( SvStream& rIn, bool /*bMasterStyle*/, sal_uInt32 nLevel } } -PPTParaSheet::PPTParaSheet( sal_uInt32 nInstance ) +PPTParaSheet::PPTParaSheet( TSS_Type nInstance ) { sal_uInt16 nBuFlags = 0; sal_uInt32 nBulletColor = 0x8000000; @@ -3835,22 +3840,23 @@ PPTParaSheet::PPTParaSheet( sal_uInt32 nInstance ) switch ( nInstance ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : + case TSS_Type::PageTitle : + case TSS_Type::Title : nBulletColor = PPT_COLSCHEME_TITELTEXT; break; - case TSS_TYPE_BODY : - case TSS_TYPE_SUBTITLE : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : + case TSS_Type::Body : + case TSS_Type::Subtitle : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : { nBuFlags = 1; nUpperDist = 0x14; } break; - case TSS_TYPE_NOTES : + case TSS_Type::Notes : nUpperDist = 0x1e; break; + default: break; } for (PPTParaLevel & i : maParaLevel) { @@ -4026,22 +4032,21 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd PPTNumberFormatCreator ( new PPTExtParaProv( rManager, rIn, &rSlideHd ) ), maTxSI ( rTextSpecInfo ) { - sal_uInt32 i; sal_uInt32 nOldFilePos = rIn.Tell(); // default stylesheets - mpCharSheet[ TSS_TYPE_PAGETITLE ] = new PPTCharSheet( TSS_TYPE_PAGETITLE ); - mpCharSheet[ TSS_TYPE_BODY ] = new PPTCharSheet( TSS_TYPE_BODY ); - mpCharSheet[ TSS_TYPE_NOTES ] = new PPTCharSheet( TSS_TYPE_NOTES ); - mpCharSheet[ TSS_TYPE_UNUSED ] = new PPTCharSheet( TSS_TYPE_UNUSED ); // this entry is not used by ppt - mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ] = new PPTCharSheet( TSS_TYPE_TEXT_IN_SHAPE ); - mpParaSheet[ TSS_TYPE_PAGETITLE ] = new PPTParaSheet( TSS_TYPE_PAGETITLE ); - mpParaSheet[ TSS_TYPE_BODY ] = new PPTParaSheet( TSS_TYPE_BODY ); - mpParaSheet[ TSS_TYPE_NOTES ] = new PPTParaSheet( TSS_TYPE_NOTES ); - mpParaSheet[ TSS_TYPE_UNUSED ] = new PPTParaSheet( TSS_TYPE_UNUSED ); - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ] = new PPTParaSheet( TSS_TYPE_TEXT_IN_SHAPE ); - mpCharSheet[ TSS_TYPE_QUARTERBODY ] = mpCharSheet[ TSS_TYPE_HALFBODY ] = mpCharSheet[ TSS_TYPE_TITLE ] = mpCharSheet[ TSS_TYPE_SUBTITLE ] = nullptr; - mpParaSheet[ TSS_TYPE_QUARTERBODY ] = mpParaSheet[ TSS_TYPE_HALFBODY ] = mpParaSheet[ TSS_TYPE_TITLE ] = mpParaSheet[ TSS_TYPE_SUBTITLE ] = nullptr; + mpCharSheet[ TSS_Type::PageTitle ] = new PPTCharSheet( TSS_Type::PageTitle ); + mpCharSheet[ TSS_Type::Body ] = new PPTCharSheet( TSS_Type::Body ); + mpCharSheet[ TSS_Type::Notes ] = new PPTCharSheet( TSS_Type::Notes ); + mpCharSheet[ TSS_Type::Unused ] = new PPTCharSheet( TSS_Type::Unused ); // this entry is not used by ppt + mpCharSheet[ TSS_Type::TextInShape ] = new PPTCharSheet( TSS_Type::TextInShape ); + mpParaSheet[ TSS_Type::PageTitle ] = new PPTParaSheet( TSS_Type::PageTitle ); + mpParaSheet[ TSS_Type::Body ] = new PPTParaSheet( TSS_Type::Body ); + mpParaSheet[ TSS_Type::Notes ] = new PPTParaSheet( TSS_Type::Notes ); + mpParaSheet[ TSS_Type::Unused ] = new PPTParaSheet( TSS_Type::Unused ); + mpParaSheet[ TSS_Type::TextInShape ] = new PPTParaSheet( TSS_Type::TextInShape ); + mpCharSheet[ TSS_Type::QuarterBody ] = mpCharSheet[ TSS_Type::HalfBody ] = mpCharSheet[ TSS_Type::Title ] = mpCharSheet[ TSS_Type::Subtitle ] = nullptr; + mpParaSheet[ TSS_Type::QuarterBody ] = mpParaSheet[ TSS_Type::HalfBody ] = mpParaSheet[ TSS_Type::Title ] = mpParaSheet[ TSS_Type::Subtitle ] = nullptr; /* SJ: try to locate the txMasterStyleAtom in the Environment @@ -4071,16 +4076,16 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd { if ( nLev ) { - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev - 1 ]; - mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev - 1 ]; + mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev - 1 ]; + mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev - 1 ]; } - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rManager, rIn, true, nLev, bFirst ); + mpParaSheet[ TSS_Type::TextInShape ]->Read( rManager, rIn, true, nLev, bFirst ); if ( !nLev ) { - // set paragraph defaults for instance 4 (TSS_TYPE_TEXT_IN_SHAPE) + // set paragraph defaults for instance 4 (TSS_Type::TextInShape) if ( rTxPFStyle.bValid ) { - PPTParaLevel& rParaLevel = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ 0 ]; + PPTParaLevel& rParaLevel = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ 0 ]; rParaLevel.mnAsianLineBreak = 0; if ( rTxPFStyle.bForbiddenRules ) rParaLevel.mnAsianLineBreak |= 1; @@ -4090,8 +4095,8 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd rParaLevel.mnAsianLineBreak |= 4; } } - mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rIn, true, nLev, bFirst ); - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ].mnFontHeight ); + mpCharSheet[ TSS_Type::TextInShape ]->Read( rIn, true, nLev, bFirst ); + mpParaSheet[ TSS_Type::TextInShape ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ].mnFontHeight ); bFirst = false; nLev++; } @@ -4122,42 +4127,43 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd } while ( ( aTxMasterStyleHd.nRecType == PPT_PST_TxMasterStyleAtom ) && ( rIn.Tell() < nEndRecPos ) ) //TODO: aTxMasterStyleHd may be used without having been properly initialized { - sal_uInt32 nInstance = aTxMasterStyleHd.nRecInstance; - if ( ( nInstance < PPT_STYLESHEETENTRYS ) && - ( ( nInstance != TSS_TYPE_TEXT_IN_SHAPE ) || !bFoundTxMasterStyleAtom04 ) ) + TSS_Type nInstance = (TSS_Type)aTxMasterStyleHd.nRecInstance; + if ( ( nInstance < TSS_Type::LAST ) && + ( ( nInstance != TSS_Type::TextInShape ) || !bFoundTxMasterStyleAtom04 ) ) { - if ( nInstance > 4 ) + if ( nInstance > TSS_Type::TextInShape ) { delete mpCharSheet[ nInstance ]; // be sure to delete the old one if this instance comes twice delete mpParaSheet[ nInstance ]; switch ( nInstance ) { - case TSS_TYPE_SUBTITLE : + case TSS_Type::Subtitle : { - mpCharSheet[ TSS_TYPE_SUBTITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_SUBTITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::Subtitle ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::Subtitle ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } break; - case TSS_TYPE_TITLE : + case TSS_Type::Title : { - mpCharSheet[ TSS_TYPE_TITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_PAGETITLE ] ) ); - mpParaSheet[ TSS_TYPE_TITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_PAGETITLE ] ) ); + mpCharSheet[ TSS_Type::Title ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::PageTitle ] ) ); + mpParaSheet[ TSS_Type::Title ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::PageTitle ] ) ); } break; - case TSS_TYPE_HALFBODY : + case TSS_Type::HalfBody : { - mpCharSheet[ TSS_TYPE_HALFBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_HALFBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::HalfBody ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::HalfBody ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } break; - case TSS_TYPE_QUARTERBODY : + case TSS_Type::QuarterBody : { - mpCharSheet[ TSS_TYPE_QUARTERBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_QUARTERBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::QuarterBody ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::QuarterBody ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } break; + default: break; } } sal_uInt16 nLevelAnz(0); @@ -4173,14 +4179,14 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd auto nTxEndRecPos = DffPropSet::SanitizeEndPos(rIn, aTxMasterStyleHd.GetRecEndFilePos()); while ( rIn.GetError() == 0 && rIn.Tell() < nTxEndRecPos && nLev < nLevelAnz ) { - if ( nLev && ( nInstance < 5 ) ) + if ( nLev && ( nInstance < TSS_Type::Subtitle ) ) { mpParaSheet[ nInstance ]->maParaLevel[ nLev ] = mpParaSheet[ nInstance ]->maParaLevel[ nLev - 1 ]; mpCharSheet[ nInstance ]->maCharLevel[ nLev ] = mpCharSheet[ nInstance ]->maCharLevel[ nLev - 1 ]; } // Exception: Template 5, 6 (MasterTitle Title und SubTitle) - if ( nInstance >= TSS_TYPE_SUBTITLE ) + if ( nInstance >= TSS_Type::Subtitle ) { bFirst = false; @@ -4224,25 +4230,25 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd break; ReadDffRecordHeader( rIn, aTxMasterStyleHd ); } - if ( !mpCharSheet[ TSS_TYPE_SUBTITLE ] ) + if ( !mpCharSheet[ TSS_Type::Subtitle ] ) { - mpCharSheet[ TSS_TYPE_SUBTITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_SUBTITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::Subtitle ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::Subtitle ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } - if ( !mpCharSheet[ TSS_TYPE_TITLE ] ) + if ( !mpCharSheet[ TSS_Type::Title ] ) { - mpCharSheet[ TSS_TYPE_TITLE ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_PAGETITLE ] ) ); - mpParaSheet[ TSS_TYPE_TITLE ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_PAGETITLE ] ) ); + mpCharSheet[ TSS_Type::Title ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::PageTitle ] ) ); + mpParaSheet[ TSS_Type::Title ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::PageTitle ] ) ); } - if ( !mpCharSheet[ TSS_TYPE_HALFBODY ] ) + if ( !mpCharSheet[ TSS_Type::HalfBody ] ) { - mpCharSheet[ TSS_TYPE_HALFBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_HALFBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::HalfBody ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::HalfBody ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } - if ( !mpCharSheet[ TSS_TYPE_QUARTERBODY ] ) + if ( !mpCharSheet[ TSS_Type::QuarterBody ] ) { - mpCharSheet[ TSS_TYPE_QUARTERBODY ] = new PPTCharSheet( *( mpCharSheet[ TSS_TYPE_BODY ] ) ); - mpParaSheet[ TSS_TYPE_QUARTERBODY ] = new PPTParaSheet( *( mpParaSheet[ TSS_TYPE_BODY ] ) ); + mpCharSheet[ TSS_Type::QuarterBody ] = new PPTCharSheet( *( mpCharSheet[ TSS_Type::Body ] ) ); + mpParaSheet[ TSS_Type::QuarterBody ] = new PPTParaSheet( *( mpParaSheet[ TSS_Type::Body ] ) ); } if ( !bFoundTxMasterStyleAtom04 ) { // try to locate the txMasterStyleAtom in the Environment @@ -4267,16 +4273,16 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd { if ( nLev ) { - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ nLev - 1 ]; - mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev - 1 ]; + mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev ] = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ nLev - 1 ]; + mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ] = mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev - 1 ]; } - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rManager, rIn, true, nLev, bFirst ); + mpParaSheet[ TSS_Type::TextInShape ]->Read( rManager, rIn, true, nLev, bFirst ); if ( !nLev ) { - // set paragraph defaults for instance 4 (TSS_TYPE_TEXT_IN_SHAPE) + // set paragraph defaults for instance 4 (TSS_Type::TextInShape) if ( rTxPFStyle.bValid ) { - PPTParaLevel& rParaLevel = mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maParaLevel[ 0 ]; + PPTParaLevel& rParaLevel = mpParaSheet[ TSS_Type::TextInShape ]->maParaLevel[ 0 ]; rParaLevel.mnAsianLineBreak = 0; if ( rTxPFStyle.bForbiddenRules ) rParaLevel.mnAsianLineBreak |= 1; @@ -4286,8 +4292,8 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd rParaLevel.mnAsianLineBreak |= 4; } } - mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->Read( rIn, true, nLev, bFirst ); - mpParaSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_TYPE_TEXT_IN_SHAPE ]->maCharLevel[ nLev ].mnFontHeight ); + mpCharSheet[ TSS_Type::TextInShape ]->Read( rIn, true, nLev, bFirst ); + mpParaSheet[ TSS_Type::TextInShape ]->UpdateBulletRelSize( nLev, mpCharSheet[ TSS_Type::TextInShape ]->maCharLevel[ nLev ].mnFontHeight ); bFirst = false; nLev++; } @@ -4304,32 +4310,32 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd rIn.Seek( nOldFilePos ); // will will create the default numbulletitem for each instance - for ( i = 0; i < PPT_STYLESHEETENTRYS; i++ ) + for ( auto i : o3tl::enumrange<TSS_Type>() ) { sal_uInt16 nLevels, nDepth = 0; SvxNumRuleType eNumRuleType; switch ( i ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : + case TSS_Type::PageTitle : + case TSS_Type::Title : nLevels = 1; eNumRuleType = SvxNumRuleType::NUMBERING; break; - case TSS_TYPE_SUBTITLE : + case TSS_Type::Subtitle : nLevels = SVX_MAX_NUM; eNumRuleType = SvxNumRuleType::NUMBERING; break; - case TSS_TYPE_BODY : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : + case TSS_Type::Body : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : nLevels = SVX_MAX_NUM; eNumRuleType = SvxNumRuleType::PRESENTATION_NUMBERING; break; default : - case TSS_TYPE_NOTES : - case TSS_TYPE_UNUSED : - case TSS_TYPE_TEXT_IN_SHAPE : + case TSS_Type::Notes : + case TSS_Type::Unused : + case TSS_Type::TextInShape : nLevels = SVX_MAX_NUM; eNumRuleType = SvxNumRuleType::NUMBERING; break; @@ -4359,7 +4365,7 @@ PPTStyleSheet::PPTStyleSheet( const DffRecordHeader& rSlideHd, SvStream& rIn, Sd PPTStyleSheet::~PPTStyleSheet() { - for ( sal_uInt32 i = 0; i < PPT_STYLESHEETENTRYS; i++ ) + for ( auto i : o3tl::enumrange<TSS_Type>() ) { delete mpCharSheet[ i ]; delete mpParaSheet[ i ]; @@ -4856,7 +4862,7 @@ void StyleTextProp9::Read( SvStream& rIn ) } PPTStyleTextPropReader::PPTStyleTextPropReader( SvStream& rIn, const DffRecordHeader& rTextHeader, - PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance ) + PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, TSS_Type nInstance ) { Init(rIn, rTextHeader, rRuler, rExtParaHd, nInstance); } @@ -5205,7 +5211,7 @@ void PPTStyleTextPropReader::ReadCharProps( SvStream& rIn, PPTCharPropSet& aChar } void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHeader, - PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, sal_uInt32 nInstance ) + PPTTextRulerInterpreter& rRuler, const DffRecordHeader& rExtParaHd, TSS_Type nInstance ) { sal_uInt32 nMerk = rIn.Tell(); sal_uInt32 nExtParaPos = ( rExtParaHd.nRecType == PPT_PST_ExtendedParagraphAtom ) ? rExtParaHd.nFilePos + 8 : 0; @@ -5259,7 +5265,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe aSpecMarkerList.push_back( (sal_uInt32)( i | PPT_SPEC_SYMBOL ) ); else if ( nChar == 0xd ) { - if ( nInstance == TSS_TYPE_PAGETITLE ) + if ( nInstance == TSS_Type::PageTitle ) *pPtr = 0xb; else aSpecMarkerList.push_back( (sal_uInt32)( i | PPT_SPEC_NEWLINE ) ); @@ -5281,7 +5287,7 @@ void PPTStyleTextPropReader::Init( SvStream& rIn, const DffRecordHeader& rTextHe break; if ( cLo == 0xd ) { - if ( nInstance == TSS_TYPE_PAGETITLE ) + if ( nInstance == TSS_Type::PageTitle ) *pPtr = 0xb; else aSpecMarkerList.push_back( (sal_uInt32)( (pPtr - pBuf.get()) | PPT_SPEC_NEWLINE ) ); @@ -5440,7 +5446,7 @@ PPTStyleTextPropReader::~PPTStyleTextPropReader() delete *it; } -PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 nInstance, sal_uInt32 nDepth ) : +PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt32 nDepth ) : PPTCharPropSet ( 0 ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), @@ -5448,7 +5454,7 @@ PPTPortionObj::PPTPortionObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 nInst { } -PPTPortionObj::PPTPortionObj( const PPTCharPropSet& rCharPropSet, const PPTStyleSheet& rStyleSheet, sal_uInt32 nInstance, sal_uInt32 nDepth ) : +PPTPortionObj::PPTPortionObj( const PPTCharPropSet& rCharPropSet, const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt32 nDepth ) : PPTCharPropSet ( rCharPropSet ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), @@ -5485,7 +5491,7 @@ bool PPTPortionObj::HasTabulator() return bRetValue; } -bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uInt32 nDestinationInstance ) const +bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Type nDestinationInstance ) const { sal_uInt32 nMask = 1 << nAttr; rRetValue = 0; @@ -5527,8 +5533,8 @@ bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uInt { const PPTCharLevel& rCharLevel = mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ]; PPTCharLevel* pCharLevel = nullptr; - if ( ( nDestinationInstance == 0xffffffff ) - || ( mnDepth && ( ( mnInstance == TSS_TYPE_SUBTITLE ) || ( mnInstance == TSS_TYPE_TEXT_IN_SHAPE ) ) ) ) + if ( ( nDestinationInstance == TSS_Type::Unknown ) + || ( mnDepth && ( ( mnInstance == TSS_Type::Subtitle ) || ( mnInstance == TSS_Type::TextInShape ) ) ) ) bIsHardAttribute = true; else if ( nDestinationInstance != mnInstance ) pCharLevel = &mrStyleSheet.mpCharSheet[ nDestinationInstance ]->maCharLevel[ mnDepth ]; @@ -5592,12 +5598,12 @@ bool PPTPortionObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uInt return bIsHardAttribute; } -void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, sal_uInt32 nDestinationInstance ) +void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, TSS_Type nDestinationInstance ) { ApplyTo( rSet, rManager, nDestinationInstance, nullptr ); } -void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, sal_uInt32 nDestinationInstance, const PPTTextObj* pTextObj ) +void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, TSS_Type nDestinationInstance, const PPTTextObj* pTextObj ) { sal_uInt32 nVal; if ( GetAttrib( PPT_CharAttr_Bold, nVal, nDestinationInstance ) ) @@ -5788,7 +5794,7 @@ void PPTPortionObj::ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, s { Color aCol( rManager.MSO_TEXT_CLR_ToColor( nVal ) ); rSet.Put( SvxColorItem( aCol, EE_CHAR_COLOR ) ); - if ( nDestinationInstance == 0xffffffff ) + if ( nDestinationInstance == TSS_Type::Unknown ) mrStyleSheet.mpCharSheet[ mnInstance ]->maCharLevel[ mnDepth ].mnFontColorInStyleSheet = aCol; } else if ( nVal & 0x0f000000 ) // this is not a hard attribute, but maybe the page has a different colorscheme, @@ -5828,7 +5834,7 @@ SvxFieldItem* PPTPortionObj::GetTextField() return nullptr; } -PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 nInstance, sal_uInt16 nDepth ) : +PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nInstance, sal_uInt16 nDepth ) : PPTNumberFormatCreator ( nullptr ), mrStyleSheet ( rStyleSheet ), mnInstance ( nInstance ), @@ -5843,7 +5849,7 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, sal_uInt32 n PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader, size_t const nCurParaPos, size_t& rnCurCharPos, const PPTStyleSheet& rStyleSheet, - sal_uInt32 nInstance, PPTTextRulerInterpreter& rRuler ) : + TSS_Type nInstance, PPTTextRulerInterpreter& rRuler ) : PPTParaPropSet ( *rPropReader.aParaPropList[nCurParaPos] ), PPTNumberFormatCreator ( nullptr ), PPTTextRulerInterpreter ( rRuler ), @@ -5907,7 +5913,7 @@ void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const } } -bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uInt32 nDestinationInstance ) +bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, TSS_Type nDestinationInstance ) { sal_uInt32 nMask = 1 << nAttr; rRetValue = 0; @@ -5935,7 +5941,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI else { rRetValue = PPT_COLSCHEME_TEXT_UND_ZEILEN; - if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty()) + if ((nDestinationInstance != TSS_Type::Unknown) && !m_PortionList.empty()) { PPTPortionObj const& rPortion = *m_PortionList.front(); if (rPortion.pCharSet->mnAttrSet & (1 << PPT_CharAttr_FontColor)) @@ -5963,7 +5969,7 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI { // it is the font used which assigned to the first character of the following text rRetValue = 0; - if ((nDestinationInstance != 0xffffffff) && !m_PortionList.empty()) + if ((nDestinationInstance != TSS_Type::Unknown) && !m_PortionList.empty()) { PPTPortionObj const& rPortion = *m_PortionList.front(); if (rPortion.pCharSet->mnAttrSet & ( 1 << PPT_CharAttr_Font ) ) @@ -5985,8 +5991,8 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI const PPTParaLevel& rParaLevel = mrStyleSheet.mpParaSheet[ mnInstance ]->maParaLevel[ pParaSet->mnDepth ]; PPTParaLevel* pParaLevel = nullptr; - if ( ( nDestinationInstance == 0xffffffff ) - || ( pParaSet->mnDepth && ( ( mnInstance == TSS_TYPE_SUBTITLE ) || ( mnInstance == TSS_TYPE_TEXT_IN_SHAPE ) ) ) ) + if ( ( nDestinationInstance == TSS_Type::Unknown ) + || ( pParaSet->mnDepth && ( ( mnInstance == TSS_Type::Subtitle ) || ( mnInstance == TSS_Type::TextInShape ) ) ) ) bIsHardAttribute = true; else if ( nDestinationInstance != mnInstance ) pParaLevel = &mrStyleSheet.mpParaSheet[ nDestinationInstance ]->maParaLevel[ pParaSet->mnDepth ]; @@ -6171,13 +6177,13 @@ bool PPTParagraphObj::GetAttrib( sal_uInt32 nAttr, sal_uInt32& rRetValue, sal_uI return bIsHardAttribute; } -void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, sal_uInt32 nDestinationInstance, const PPTParagraphObj* /*pPrev*/) +void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, TSS_Type nDestinationInstance, const PPTParagraphObj* /*pPrev*/) { sal_Int16 nVal2; sal_uInt32 nVal, nUpperDist, nLowerDist; - sal_uInt32 nInstance = nDestinationInstance != 0xffffffff ? nDestinationInstance : mnInstance; + TSS_Type nInstance = nDestinationInstance != TSS_Type::Unknown ? nDestinationInstance : mnInstance; - if ( ( nDestinationInstance != 0xffffffff ) || ( pParaSet->mnDepth <= 1 ) ) + if ( ( nDestinationInstance != TSS_Type::Unknown ) || ( pParaSet->mnDepth <= 1 ) ) { SvxNumBulletItem* pNumBulletItem = mrStyleSheet.mpNumBulletItem[ nInstance ]; if ( pNumBulletItem ) @@ -6481,7 +6487,7 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport mpImplTextObj->mnShapeId = 0; mpImplTextObj->mnShapeMaster = 0; mpImplTextObj->mpPlaceHolderAtom = nullptr; - mpImplTextObj->mnDestinationInstance = mpImplTextObj->mnInstance = 4; + mpImplTextObj->mnDestinationInstance = mpImplTextObj->mnInstance = TSS_Type::TextInShape; mpImplTextObj->mnCurrentObject = 0; mpImplTextObj->mnParagraphCount = 0; mpImplTextObj->mpParagraphList = nullptr; @@ -6667,10 +6673,11 @@ PPTTextObj::PPTTextObj( SvStream& rIn, SdrPowerPointImport& rSdrPowerPointImport if ( SvxMSDffManager::SeekToRec( rIn, PPT_PST_TextHeaderAtom, aClientTextBoxHd.GetRecEndFilePos(), &aTextHd ) ) { // TextHeaderAtom is always the first Atom - sal_uInt16 nInstance; - rIn.ReadUInt16( nInstance ); // this number tells us the TxMasterStyleAtom Instance - if ( nInstance > 8 ) - nInstance = 4; + sal_uInt16 nTmp; + rIn.ReadUInt16( nTmp ); // this number tells us the TxMasterStyleAtom Instance + if ( nTmp > 8 ) + nTmp = 4; + TSS_Type nInstance = (TSS_Type)nTmp; aTextHd.SeekToEndOfRecord( rIn ); mpImplTextObj->mnInstance = nInstance; diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 2daa00e05e89..d342f5f055f0 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -39,6 +39,7 @@ #include <vector> #include <memory> #include <boost/optional.hpp> +#include <o3tl/enumarray.hxx> class SdrModel; class SdPage; @@ -152,15 +153,19 @@ enum PPT_TextHeader PPTTH_QUARTERBODY // Body in four-body slide }; -#define TSS_TYPE_PAGETITLE (0) -#define TSS_TYPE_BODY (1) -#define TSS_TYPE_NOTES (2) -#define TSS_TYPE_UNUSED (3) -#define TSS_TYPE_TEXT_IN_SHAPE (4) -#define TSS_TYPE_SUBTITLE (5) -#define TSS_TYPE_TITLE (6) -#define TSS_TYPE_HALFBODY (7) -#define TSS_TYPE_QUARTERBODY (8) +enum class TSS_Type : unsigned { + PageTitle = 0, + Body = 1, + Notes = 2, + Unused = 3, + TextInShape = 4, + Subtitle = 5, + Title = 6, + HalfBody = 7, + QuarterBody = 8, + LAST = QuarterBody, + Unknown = 0xffffffff // or invalid +}; // Inventor-Id for PPT UserData const sal_uInt32 PPTInventor = sal_uInt32('P') * 0x00000001 @@ -712,7 +717,7 @@ public: bool bGraphics; DffRecordManager aExtendedPresRules; - PPTExtParaSheet aExtParaSheet[ PPT_STYLESHEETENTRYS ]; + o3tl::enumarray<TSS_Type, PPTExtParaSheet> aExtParaSheet; bool GetGraphic( sal_uInt32 nInstance, Graphic& rGraphic ) const; @@ -739,7 +744,7 @@ struct PPTCharSheet { PPTCharLevel maCharLevel[nMaxPPTLevels]; - explicit PPTCharSheet( sal_uInt32 nInstance ); + explicit PPTCharSheet( TSS_Type nInstance ); PPTCharSheet( const PPTCharSheet& rCharSheet ); void Read( SvStream& rIn, bool bMasterStyle, sal_uInt32 nLevel, bool bFirst ); @@ -772,7 +777,7 @@ public: PPTParaLevel maParaLevel[nMaxPPTLevels]; - explicit PPTParaSheet( sal_uInt32 nInstance ); + explicit PPTParaSheet( TSS_Type nInstance ); PPTParaSheet( const PPTParaSheet& rParaSheet ); void Read( @@ -805,8 +810,8 @@ class PPTNumberFormatCreator SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, sal_uInt32 nLevel, - sal_uInt32 nInstance, - sal_uInt32 nInstanceInSheet, + TSS_Type nInstance, + TSS_Type nInstanceInSheet, boost::optional< sal_Int16 >& rStartNumbering, sal_uInt32 nFontHeight, PPTParagraphObj* pPara @@ -827,14 +832,14 @@ public: sal_uInt32 nLevel, const PPTParaLevel& rParaLevel, const PPTCharLevel& rCharLevel, - sal_uInt32 nInstance + TSS_Type nInstance ); bool GetNumberFormat( SdrPowerPointImport& rMan, SvxNumberFormat& rNumberFormat, PPTParagraphObj* pPara, - sal_uInt32 nInstanceInSheet, + TSS_Type nInstanceInSheet, boost::optional< sal_Int16 >& rStartNumbering ); }; @@ -843,9 +848,9 @@ class SvxNumBulletItem; struct PPTStyleSheet : public PPTNumberFormatCreator { PPTTextSpecInfo maTxSI; - PPTCharSheet* mpCharSheet[ PPT_STYLESHEETENTRYS ]; - PPTParaSheet* mpParaSheet[ PPT_STYLESHEETENTRYS ]; - SvxNumBulletItem* mpNumBulletItem[ PPT_STYLESHEETENTRYS ]; + o3tl::enumarray<TSS_Type, PPTCharSheet*> mpCharSheet; + o3tl::enumarray<TSS_Type, PPTParaSheet*> mpParaSheet; + o3tl::enumarray<TSS_Type, SvxNumBulletItem*> mpNumBulletItem; PPTStyleSheet( const DffRecordHeader& rSlideHd, @@ -1057,7 +1062,7 @@ struct PPTStyleTextPropReader const DffRecordHeader& rClientTextBoxHd, PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, - sal_uInt32 nTextInstance + TSS_Type nTextInstance ); ~PPTStyleTextPropReader(); @@ -1066,7 +1071,7 @@ struct PPTStyleTextPropReader const DffRecordHeader& rClientTextBoxHd, PPTTextRulerInterpreter& rInterpreter, const DffRecordHeader& rExtParaHd, - sal_uInt32 nTextInstance + TSS_Type nTextInstance ); void ReadParaProps( SvStream& rIn, @@ -1099,19 +1104,19 @@ class MSFILTER_DLLPUBLIC PPTPortionObj : public PPTCharPropSet friend class PPTParagraphObj; const PPTStyleSheet& mrStyleSheet; - sal_uInt32 mnInstance; + TSS_Type mnInstance; sal_uInt32 mnDepth; public: - bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ) const; + bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet ) const; SvxFieldItem* GetTextField(); - PPTPortionObj( const PPTStyleSheet&, sal_uInt32 nInstance, sal_uInt32 nDepth ); + PPTPortionObj( const PPTStyleSheet&, TSS_Type nInstance, sal_uInt32 nDepth ); PPTPortionObj( const PPTCharPropSet&, const PPTStyleSheet&, - sal_uInt32 nInstance, + TSS_Type nInstance, sal_uInt32 nDepth ); PPTPortionObj( const PPTPortionObj& ); @@ -1121,12 +1126,12 @@ public: void ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, - sal_uInt32 nInstanceInSheet + TSS_Type nInstanceInSheet ); void ApplyTo( SfxItemSet& rSet, SdrPowerPointImport& rManager, - sal_uInt32 nInstanceInSheet, + TSS_Type nInstanceInSheet, const PPTTextObj* pTextObj ); sal_uInt32 Count() const { return ( mpFieldItem ) ? 1 : maString.getLength(); }; @@ -1142,7 +1147,7 @@ class MSFILTER_DLLPUBLIC PPTParagraphObj friend class PPTNumberFormatCreator; const PPTStyleSheet& mrStyleSheet; - sal_uInt32 mnInstance; + TSS_Type mnInstance; PPTParagraphObj(PPTParagraphObj const&) = delete; void operator=(PPTParagraphObj const&) = delete; @@ -1155,11 +1160,11 @@ public: ::std::vector<std::unique_ptr<PPTPortionObj>> m_PortionList; void UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const; - bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, sal_uInt32 nInstanceInSheet ); + bool GetAttrib( sal_uInt32 nAttr, sal_uInt32& nVal, TSS_Type nInstanceInSheet ); PPTParagraphObj( const PPTStyleSheet&, - sal_uInt32 nInstance, + TSS_Type nInstance, sal_uInt16 nDepth ); PPTParagraphObj( @@ -1167,7 +1172,7 @@ public: size_t nCurParaPos, size_t& rnCurCharPos, const PPTStyleSheet&, - sal_uInt32 nInstance, + TSS_Type nInstance, PPTTextRulerInterpreter& rRuler ); ~PPTParagraphObj(); @@ -1181,7 +1186,7 @@ public: SfxItemSet& rSet, boost::optional< sal_Int16 >& rStartNumbering, SdrPowerPointImport& rManager, - sal_uInt32 nInstanceInSheet, + TSS_Type nInstanceInSheet, const PPTParagraphObj* pPrev ); }; @@ -1198,8 +1203,8 @@ struct ImplPPTTextObj sal_uInt32 mnShapeId; sal_uInt32 mnShapeMaster; PptOEPlaceholderAtom* mpPlaceHolderAtom; - sal_uInt16 mnInstance; - sal_uInt16 mnDestinationInstance; + TSS_Type mnInstance; + TSS_Type mnDestinationInstance; MSO_SPT meShapeType; sal_uInt32 mnCurrentObject; @@ -1214,8 +1219,8 @@ struct ImplPPTTextObj , mnShapeId(0) , mnShapeMaster(0) , mpPlaceHolderAtom(nullptr) - , mnInstance(0) - , mnDestinationInstance(0) + , mnInstance(TSS_Type::PageTitle) + , mnDestinationInstance(TSS_Type::PageTitle) , meShapeType(mso_sptMin) , mnCurrentObject(0) , mnParagraphCount(0) @@ -1245,14 +1250,14 @@ public: PPTParagraphObj* First(); PPTParagraphObj* Next(); MSO_SPT GetShapeType() const { return mpImplTextObj->meShapeType; }; - sal_uInt32 GetInstance() const { return mpImplTextObj->mnInstance; }; - void SetInstance( sal_uInt16 nInstance ) + TSS_Type GetInstance() const { return mpImplTextObj->mnInstance; }; + void SetInstance( TSS_Type nInstance ) { mpImplTextObj->mnInstance = nInstance; } - sal_uInt32 GetDestinationInstance() const + TSS_Type GetDestinationInstance() const { return mpImplTextObj->mnDestinationInstance; } - void SetDestinationInstance( sal_uInt16 nInstance ) + void SetDestinationInstance( TSS_Type nInstance ) { mpImplTextObj->mnDestinationInstance = nInstance; } PptOEPlaceholderAtom* GetOEPlaceHolderAtom() const { return mpImplTextObj->mpPlaceHolderAtom; } diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 269ebbba1833..2d770248c026 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -602,11 +602,11 @@ bool ImplSdPPTImport::Import() if ( pSheet ) { SfxItemSet& rItemSet = pSheet->GetItemSet(); - PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 ); - PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 ); + PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::TextInShape, 0 ); + PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::TextInShape, 0 ); aParagraph.AppendPortion( aPortion ); - aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, nullptr ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, nullptr ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); } } @@ -615,11 +615,11 @@ bool ImplSdPPTImport::Import() if ( pSheet ) { SfxItemSet& rItemSet = pSheet->GetItemSet(); - PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 ); - PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_TEXT_IN_SHAPE, 0 ); + PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::TextInShape, 0 ); + PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::TextInShape, 0 ); aParagraph.AppendPortion( aPortion ); - aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, nullptr ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, nullptr ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); } // create layoutstylesheets, set layoutname and stylesheet @@ -645,14 +645,14 @@ bool ImplSdPPTImport::Import() // set stylesheets if ( pPage->GetPageKind() == PK_STANDARD ) { - sal_uInt32 nTitleInstance = TSS_TYPE_PAGETITLE; - sal_uInt32 nOutlinerInstance = TSS_TYPE_BODY; + TSS_Type nTitleInstance = TSS_Type::PageTitle; + TSS_Type nOutlinerInstance = TSS_Type::Body; const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom(); bool bSwapStyleSheet = pSlideLayout->eLayout == PptSlideLayout::TITLEMASTERSLIDE; if ( bSwapStyleSheet ) { - nTitleInstance = TSS_TYPE_TITLE; - nOutlinerInstance = TSS_TYPE_SUBTITLE; + nTitleInstance = TSS_Type::Title; + nOutlinerInstance = TSS_Type::Subtitle; } // titelstylesheet @@ -663,8 +663,8 @@ bool ImplSdPPTImport::Import() PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 ); PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 ); aParagraph.AppendPortion( aPortion ); - aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, nullptr ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, nullptr ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); } // outlinerstylesheet @@ -685,8 +685,8 @@ bool ImplSdPPTImport::Import() SfxItemSet& rItemSet = pOutlineSheet->GetItemSet(); PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel ); pParagraphs[ nLevel ]->AppendPortion( aPortion ); - pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, pPreviousPara ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, pPreviousPara ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); pPreviousPara = pParagraphs[ nLevel ]; } else @@ -699,11 +699,11 @@ bool ImplSdPPTImport::Import() if ( pSheet ) { SfxItemSet& rItemSet = pSheet->GetItemSet(); - PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 ); - PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_SUBTITLE, 0 ); + PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::Subtitle, 0 ); + PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::Subtitle, 0 ); aParagraph.AppendPortion( aPortion ); - aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, nullptr ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, nullptr ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); } } else if ( ePgKind == PK_NOTES ) @@ -712,11 +712,11 @@ bool ImplSdPPTImport::Import() if ( pSheet ) { SfxItemSet& rItemSet = pSheet->GetItemSet(); - PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 ); - PPTPortionObj aPortion( *pPPTStyleSheet, TSS_TYPE_NOTES, 0 ); + PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::Notes, 0 ); + PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::Notes, 0 ); aParagraph.AppendPortion( aPortion ); - aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, 0xffffffff, nullptr ); - aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, 0xffffffff ); + aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown, nullptr ); + aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown ); } } } @@ -2213,8 +2213,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj } switch ( pTextObj->GetDestinationInstance() ) { - case TSS_TYPE_PAGETITLE : - case TSS_TYPE_TITLE : + case TSS_Type::PageTitle : + case TSS_Type::Title : { pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TITLE ); if ( pSheet ) @@ -2222,7 +2222,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for titleobject (SJ)" ); } break; - case TSS_TYPE_SUBTITLE : + case TSS_Type::Subtitle : { pSheet = pPage->GetStyleSheetForPresObj( PRESOBJ_TEXT ); if ( pSheet ) @@ -2230,9 +2230,9 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj DBG_ASSERT( pSheet, "ImplSdPPTImport::ApplyTextObj -> could not get stylesheet for subtitleobject (SJ)" ); } break; - case TSS_TYPE_BODY : - case TSS_TYPE_HALFBODY : - case TSS_TYPE_QUARTERBODY : + case TSS_Type::Body : + case TSS_Type::HalfBody : + case TSS_Type::QuarterBody : { for ( sal_uInt16 nLevel = 9; nLevel; nLevel-- ) { @@ -2250,7 +2250,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj ppStyleSheetAry = &pStyleSheetAry[ 0 ]; } break; - case TSS_TYPE_NOTES : + case TSS_Type::Notes : { if ( pPlaceHolder && ( ( pPlaceHolder->nPlaceholderId == PptPlaceholder::NOTESSLIDEIMAGE ) || ( pPlaceHolder->nPlaceholderId == PptPlaceholder::MASTERNOTESSLIDEIMAGE ) ) ) @@ -2269,8 +2269,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj } } break; - case TSS_TYPE_UNUSED : - case TSS_TYPE_TEXT_IN_SHAPE : + case TSS_Type::Unused : + case TSS_Type::TextInShape : { switch( ePresKind ) { @@ -2285,16 +2285,17 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj } } break; + default: break; } pText = static_cast<SdrTextObj*>(SdrPowerPointImport::ApplyTextObj( pTextObj, pText, pPageCapsule, pSheet, ppStyleSheetAry )); if ( pPlaceHolder && pPlaceHolder->nPlaceholderId != PptPlaceholder::NONE ) { if ( eAktPageKind == PPT_MASTERPAGE ) { - bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_TYPE_UNUSED ); + bool bCreatePlaceHolder = ( pTextObj->GetInstance() != TSS_Type::Unused ); bool bIsHeaderFooter = ( ePresKind == PRESOBJ_HEADER) || (ePresKind == PRESOBJ_FOOTER) || (ePresKind == PRESOBJ_DATETIME) || (ePresKind == PRESOBJ_SLIDENUMBER); - if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_TYPE_TEXT_IN_SHAPE ) ) + if ( bCreatePlaceHolder && ( pTextObj->GetInstance() == TSS_Type::TextInShape ) ) bCreatePlaceHolder = bIsHeaderFooter; if ( bCreatePlaceHolder ) { @@ -2306,7 +2307,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj pText->SetUserCall( pPage ); pPage->InsertPresObj( pText, ePresKind ); SdrOutliner* pOutl = nullptr; - if ( pTextObj->GetInstance() == TSS_TYPE_NOTES ) + if ( pTextObj->GetInstance() == TSS_Type::Notes ) pOutl = GetDrawOutliner( pText ); if ( !aPresentationText.isEmpty() ) pPage->SetObjText( pText, pOutl, ePresKind, aPresentationText ); @@ -2323,8 +2324,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj rItemSet.Put( static_cast<const SdrMetricItem&>(pText->GetMergedItem( SDRATTR_TEXT_LOWERDIST )) ); rItemSet.Put( static_cast<const SdrTextVertAdjustItem&>(pText->GetMergedItem( SDRATTR_TEXT_VERTADJUST )) ); rItemSet.Put( static_cast<const SdrTextHorzAdjustItem&>(pText->GetMergedItem( SDRATTR_TEXT_HORZADJUST )) ); - if ( pTextObj->GetInstance() == TSS_TYPE_TITLE - || pTextObj->GetInstance() == TSS_TYPE_SUBTITLE) + if ( pTextObj->GetInstance() == TSS_Type::Title + || pTextObj->GetInstance() == TSS_Type::Subtitle) { rItemSet.Put( pText->GetMergedItemSet() ); } |