summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Madl <tobias.madl.dev@gmail.com>2014-12-11 14:45:53 +0000
committerNoel Grandin <noelgrandin@gmail.com>2014-12-12 08:07:07 +0000
commitf5c5bab09f2e3a7e13a6b397faf4bdfcb898f295 (patch)
treed6214c09038ca6f4d9256d35ec840986ddda0527
parentc953690b9adaf632f830dbf67e078ea00747894d (diff)
fdo#84938 replace PPT_LAYOUT_ constants with enum
Change-Id: I3c77e7e551bd4b657cb58fdfeead73d50441e890 Reviewed-on: https://gerrit.libreoffice.org/13437 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--filter/source/msfilter/svdfppt.cxx8
-rw-r--r--include/filter/msfilter/svdfppt.hxx44
-rw-r--r--sd/source/filter/ppt/pptin.cxx56
3 files changed, 57 insertions, 51 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 0400f5bce454..c74fc490b3cc 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -293,14 +293,16 @@ SvStream& ReadPptDocumentAtom(SvStream& rIn, PptDocumentAtom& rAtom)
void PptSlideLayoutAtom::Clear()
{
- eLayout = 0;
+ eLayout = PptSlideLayout::TITLESLIDE;
for ( sal_uInt16 i = 0; i < 8; i++ )
aPlaceholderId[ i ] = 0;
}
SvStream& ReadPptSlideLayoutAtom( SvStream& rIn, PptSlideLayoutAtom& rAtom )
{
- rIn.ReadInt32( rAtom.eLayout );
+ sal_Int32 nTmp;
+ rIn.ReadInt32(nTmp);
+ rAtom.eLayout = static_cast<PptSlideLayout>(nTmp);
rIn.Read( rAtom.aPlaceholderId, 8 );
return rIn;
}
@@ -988,7 +990,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
case TSS_TYPE_PAGETITLE :
case TSS_TYPE_TITLE :
{
- if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
nDestinationInstance = TSS_TYPE_TITLE;
else
nDestinationInstance = TSS_TYPE_PAGETITLE;
diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx
index c7a191223db2..43c846a3eefa 100644
--- a/include/filter/msfilter/svdfppt.hxx
+++ b/include/filter/msfilter/svdfppt.hxx
@@ -54,6 +54,7 @@ class SvxMSDffManager;
class PPTTextObj;
class DffRecordHeader;
class SvxBulletItem;
+enum class PptSlideLayout;
#define PPT_IMPORTFLAGS_NO_TEXT_ASSERT 1
@@ -194,7 +195,7 @@ public:
struct PptSlideLayoutAtom
{
- sal_Int32 eLayout; // 0..18
+ PptSlideLayout eLayout; // 0..18
sal_uInt8 aPlaceholderId[ 8 ];
public:
@@ -1574,25 +1575,28 @@ public :
#define PPT_CharAttr_Escapement 19 //00080000
// values for PptSlideLayoutAtom.eLayout
-#define PPT_LAYOUT_TITLESLIDE 0 // The slide is a title slide
-#define PPT_LAYOUT_TITLEANDBODYSLIDE 1 // Title and body slide
-#define PPT_LAYOUT_TITLEMASTERSLIDE 2 // Title master slide
-#define PPT_LAYOUT_MASTERSLIDE 3 // Master slide layout
-#define PPT_LAYOUT_MASTERNOTES 4 // Master notes layout
-#define PPT_LAYOUT_NOTESTITLEBODY 5 // Notes title/body layout
-#define PPT_LAYOUT_HANDOUTLAYOUT 6 // Handout layout, therefore it doesn't have placeholders except header, footer, and date
-#define PPT_LAYOUT_ONLYTITLE 7 // Only title placeholder
-#define PPT_LAYOUT_2COLUMNSANDTITLE 8 // Body of the slide has 2 columns and a title
-#define PPT_LAYOUT_2ROWSANDTITLE 9 // Slide's body has 2 rows and a title
-#define PPT_LAYOUT_RIGHTCOLUMN2ROWS 10 // Body contains 2 columns, right column has 2 rows
-#define PPT_LAYOUT_LEFTCOLUMN2ROWS 11 // Body contains 2 columns, left column has 2 rows
-#define PPT_LAYOUT_BOTTOMROW2COLUMNS 12 // Body contains 2 rows, bottom row has 2 columns
-#define PPT_LAYOUT_TOPROW2COLUMN 13 // Body contains 2 rows, top row has 2 columns
-#define PPT_LAYOUT_4OBJECTS 14 // 4 objects
-#define PPT_LAYOUT_BIGOBJECT 15 // Big object
-#define PPT_LAYOUT_BLANCSLIDE 16 // Blank slide
-#define PPT_LAYOUT_TITLERIGHTBODYLEFT 17 // Vertical title on the right, body on the left
-#define PPT_LAYOUT_TITLERIGHT2BODIESLEFT 18 // Vertical title on the right, body on the left split into 2 rows
+enum class PptSlideLayout
+{
+ TITLESLIDE = 0, // The slide is a title slide
+ TITLEANDBODYSLIDE = 1, // Title and body slide
+ TITLEMASTERSLIDE = 2, // Title master slide
+ MASTERSLIDE = 3, // Master slide layout
+ MASTERNOTES = 4, // Master notes layout
+ NOTESTITLEBODY = 5, // Notes title/body layout
+ HANDOUTLAYOUT = 6, // Handout layout, therefore it doesn't have placeholders except header, footer, and date
+ ONLYTITLE = 7, // Only title placeholder
+ TWOCOLUMNSANDTITLE = 8, // Body of the slide has 2 columns and a title
+ TWOROWSANDTITLE = 9, // Slide's body has 2 rows and a title
+ RIGHTCOLUMN2ROWS = 10, // Body contains 2 columns, right column has 2 rows
+ LEFTCOLUMN2ROWS = 11, // Body contains 2 columns, left column has 2 rows
+ BOTTOMROW2COLUMNS = 12, // Body contains 2 rows, bottom row has 2 columns
+ TOPROW2COLUMN = 13, // Body contains 2 rows, top row has 2 columns
+ FOUROBJECTS = 14, // 4 objects
+ BIGOBJECT = 15, // Big object
+ BLANCSLIDE = 16, // Blank slide
+ TITLERIGHTBODYLEFT = 17, // Vertical title on the right, body on the left
+ TITLERIGHT2BODIESLEFT = 18 // Vertical title on the right, body on the left split into 2 rows
+};
// the following table describes the placeholder id's (values from reality followed by values taken from the documentation)
#define PPT_PLACEHOLDER_NONE 0 // 0 None
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 099a88fd59af..9b0d57eec97d 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -622,7 +622,7 @@ bool ImplSdPPTImport::Import()
sal_uInt32 nTitleInstance = TSS_TYPE_PAGETITLE;
sal_uInt32 nOutlinerInstance = TSS_TYPE_BODY;
const PptSlideLayoutAtom* pSlideLayout = GetSlideLayoutAtom();
- bool bSwapStyleSheet = pSlideLayout->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE;
+ bool bSwapStyleSheet = pSlideLayout->eLayout == PptSlideLayout::TITLEMASTERSLIDE;
if ( bSwapStyleSheet )
{
nTitleInstance = TSS_TYPE_TITLE;
@@ -1006,9 +1006,9 @@ bool ImplSdPPTImport::Import()
SetPageNum( nMaster, PPT_MASTERPAGE );
if ( !pFoundMaster )
pFoundMaster = pMaster;
- else if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ else if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
pFoundMaster = pMaster;
- if ( GetSlideLayoutAtom()->eLayout == PPT_LAYOUT_TITLEMASTERSLIDE )
+ if ( GetSlideLayoutAtom()->eLayout == PptSlideLayout::TITLEMASTERSLIDE )
break;
}
}
@@ -1043,7 +1043,7 @@ bool ImplSdPPTImport::Import()
{
switch ( pSlideLayout->eLayout ) // presentation layout for standard pages
{
- case PPT_LAYOUT_TITLEANDBODYSLIDE :
+ case PptSlideLayout::TITLEANDBODYSLIDE :
{
eAutoLayout = AUTOLAYOUT_ENUM;
sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
@@ -1071,7 +1071,7 @@ bool ImplSdPPTImport::Import()
}
break;
- case PPT_LAYOUT_2COLUMNSANDTITLE :
+ case PptSlideLayout::TWOCOLUMNSANDTITLE :
{
eAutoLayout = AUTOLAYOUT_2TEXT;
sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
@@ -1097,7 +1097,7 @@ bool ImplSdPPTImport::Import()
}
break;
- case PPT_LAYOUT_2ROWSANDTITLE :
+ case PptSlideLayout::TWOROWSANDTITLE :
{
eAutoLayout = AUTOLAYOUT_2TEXT;
sal_uInt16 nID1 = pSlideLayout->aPlaceholderId[ 1 ];
@@ -1109,41 +1109,41 @@ bool ImplSdPPTImport::Import()
}
break;
- case PPT_LAYOUT_TITLESLIDE :
+ case PptSlideLayout::TITLESLIDE :
eAutoLayout = AUTOLAYOUT_TITLE;
break;
- case PPT_LAYOUT_ONLYTITLE :
+ case PptSlideLayout::ONLYTITLE :
eAutoLayout = AUTOLAYOUT_ONLY_TITLE;
break;
- case PPT_LAYOUT_RIGHTCOLUMN2ROWS :
+ case PptSlideLayout::RIGHTCOLUMN2ROWS :
eAutoLayout = AUTOLAYOUT_TEXT2OBJ;
break;
- case PPT_LAYOUT_LEFTCOLUMN2ROWS :
+ case PptSlideLayout::LEFTCOLUMN2ROWS :
eAutoLayout = AUTOLAYOUT_2OBJTEXT;
break;
- case PPT_LAYOUT_TOPROW2COLUMN :
+ case PptSlideLayout::TOPROW2COLUMN :
eAutoLayout = AUTOLAYOUT_2OBJOVERTEXT;
break;
- case PPT_LAYOUT_4OBJECTS :
+ case PptSlideLayout::FOUROBJECTS :
eAutoLayout = AUTOLAYOUT_4OBJ;
break;
- case PPT_LAYOUT_BIGOBJECT :
+ case PptSlideLayout::BIGOBJECT :
eAutoLayout = AUTOLAYOUT_OBJ;
break;
- case PPT_LAYOUT_TITLERIGHTBODYLEFT :
+ case PptSlideLayout::TITLERIGHTBODYLEFT :
eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_VERTICAL_OUTLINE; // AUTOLAYOUT_ENUM;
break;
- case PPT_LAYOUT_TITLERIGHT2BODIESLEFT :
+ case PptSlideLayout::TITLERIGHT2BODIESLEFT :
eAutoLayout = AUTOLAYOUT_VERTICAL_TITLE_TEXT_CHART; // AUTOLAYOUT_TEXT2OBJ;
break;
- case PPT_LAYOUT_BOTTOMROW2COLUMNS :
- case PPT_LAYOUT_BLANCSLIDE :
- case PPT_LAYOUT_MASTERSLIDE : // layout of the standard and title master page
- case PPT_LAYOUT_TITLEMASTERSLIDE :
- case PPT_LAYOUT_MASTERNOTES : // layout of the note master page
- case PPT_LAYOUT_NOTESTITLEBODY : // presentation layout for note pages
- case PPT_LAYOUT_HANDOUTLAYOUT : // presentation layout for handout
+ case PptSlideLayout::BOTTOMROW2COLUMNS :
+ case PptSlideLayout::BLANCSLIDE :
+ case PptSlideLayout::MASTERSLIDE : // layout of the standard and title master page
+ case PptSlideLayout::TITLEMASTERSLIDE :
+ case PptSlideLayout::MASTERNOTES : // layout of the note master page
+ case PptSlideLayout::NOTESTITLEBODY : // presentation layout for note pages
+ case PptSlideLayout::HANDOUTLAYOUT : // presentation layout for handout
eAutoLayout = AUTOLAYOUT_NONE;
break;
}
@@ -1381,7 +1381,7 @@ void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlide
{
bool bVisible = pHFE->IsToDisplay( i );
if ( ( eAktPageKind == PPT_SLIDEPAGE )
- && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PPT_LAYOUT_TITLESLIDE )
+ && ( rSlidePersist.aSlideAtom.aLayout.eLayout == PptSlideLayout::TITLESLIDE )
&& ( aDocAtom.bTitlePlaceholdersOmitted ) )
{
bVisible = false;
@@ -2406,12 +2406,12 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
case 1:
{
- if ( pSlideLayout->eLayout == PPT_LAYOUT_TITLEANDBODYSLIDE )
+ if ( pSlideLayout->eLayout == PptSlideLayout::TITLEANDBODYSLIDE )
{ // position in outline area
if ( aLogicRect != aOutlineRect )
pPresObj->SetUserCall( NULL );
}
- else if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
{ // position in outline area left
if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
@@ -2422,7 +2422,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
pPresObj->SetUserCall(NULL);
}
}
- else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
{ // position in outline area top
if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
@@ -2441,7 +2441,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
case 2:
{
- if ( pSlideLayout->eLayout == PPT_LAYOUT_2COLUMNSANDTITLE )
+ if ( pSlideLayout->eLayout == PptSlideLayout::TWOCOLUMNSANDTITLE )
{ // position in outline area right
if (std::abs(aLogicRect.Right() - aOutlineRect.Right()) > MAX_USER_MOVE ||
std::abs(aLogicRect.Top() - aOutlineRect.Top()) > MAX_USER_MOVE ||
@@ -2452,7 +2452,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
pPresObj->SetUserCall( NULL );
}
}
- else if ( pSlideLayout->eLayout == PPT_LAYOUT_2ROWSANDTITLE )
+ else if ( pSlideLayout->eLayout == PptSlideLayout::TWOROWSANDTITLE )
{ // position in outline area bottom
if (std::abs(aLogicRect.Left() - aOutlineRect.Left()) > MAX_USER_MOVE ||
std::abs(aLogicRect.Bottom() - aOutlineRect.Bottom()) > MAX_USER_MOVE ||