[Libreoffice-commits] core.git: sd/inc sd/qa sd/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Wed Apr 1 08:28:21 UTC 2020
sd/inc/prlayout.hxx | 30 ++++++++++++------------
sd/qa/unit/dialogs-test.cxx | 2 -
sd/source/core/stlsheet.cxx | 4 +--
sd/source/ui/dlg/prltempl.cxx | 50 ++++++++++++++++++++---------------------
sd/source/ui/func/fuprobjs.cxx | 4 +--
sd/source/ui/func/futempl.cxx | 32 +++++++++++++-------------
sd/source/ui/view/drtxtob1.cxx | 2 -
7 files changed, 62 insertions(+), 62 deletions(-)
New commits:
commit 4de3d96458006b8312446397b423bc3dc5d50294
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Apr 1 09:16:28 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Apr 1 10:27:43 2020 +0200
convert PresentationObjects to scoped enum
Change-Id: I65c030d33b0c3ed6350e98e9a8a63414c905f88c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91462
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sd/inc/prlayout.hxx b/sd/inc/prlayout.hxx
index fcd83737dd86..54c62dda96dc 100644
--- a/sd/inc/prlayout.hxx
+++ b/sd/inc/prlayout.hxx
@@ -26,22 +26,22 @@
#ifndef INCLUDED_SD_INC_PRLAYOUT_HXX
#define INCLUDED_SD_INC_PRLAYOUT_HXX
-enum PresentationObjects
+enum class PresentationObjects
{
- PO_TITLE,
- PO_BACKGROUND,
- PO_BACKGROUNDOBJECTS,
- PO_OUTLINE_1,
- PO_OUTLINE_2,
- PO_OUTLINE_3,
- PO_OUTLINE_4,
- PO_OUTLINE_5,
- PO_OUTLINE_6,
- PO_OUTLINE_7,
- PO_OUTLINE_8,
- PO_OUTLINE_9,
- PO_NOTES,
- PO_SUBTITLE
+ Title,
+ Background,
+ BackgroundObjects,
+ Outline_1,
+ Outline_2,
+ Outline_3,
+ Outline_4,
+ Outline_5,
+ Outline_6,
+ Outline_7,
+ Outline_8,
+ Outline_9,
+ Notes,
+ Subtitle
};
#endif // INCLUDED_SD_INC_PRLAYOUT_HXX
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index a3f39a69650b..396e4f9980e6 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -461,7 +461,7 @@ VclPtr<VclAbstractDialog> SdDialogsTest::createDialogByID(sal_uInt32 nID)
pWin ? pWin->GetFrameWeld() : nullptr,
false,
*pStyleSheet,
- PO_TITLE,
+ PresentationObjects::Title,
pStyleSheetPool);
break;
}
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index ab8e01cfd629..c19b87e67645 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -1316,12 +1316,12 @@ void SdStyleSheet::BroadcastSdStyleSheetChange(SfxStyleSheetBase const * pStyleS
SdStyleSheet* pRealSheet = static_cast<SdStyleSheet const *>(pStyleSheet)->GetRealStyleSheet();
pRealSheet->Broadcast(SfxHint(SfxHintId::DataChanged));
- if( !((ePO >= PO_OUTLINE_1) && (ePO <= PO_OUTLINE_8)) )
+ if( !((ePO >= PresentationObjects::Outline_1) && (ePO <= PresentationObjects::Outline_8)) )
return;
OUString sStyleName(SdResId(STR_PSEUDOSHEET_OUTLINE) + " ");
- for( sal_uInt16 n = static_cast<sal_uInt16>(ePO - PO_OUTLINE_1 + 2); n < 10; n++ )
+ for( sal_uInt16 n = static_cast<sal_uInt16>(ePO) - static_cast<sal_uInt16>(PresentationObjects::Outline_1) + 2; n < 10; n++ )
{
OUString aName( sStyleName + OUString::number(n) );
diff --git a/sd/source/ui/dlg/prltempl.cxx b/sd/source/ui/dlg/prltempl.cxx
index 3e6fb20f3d93..55dada4755d3 100644
--- a/sd/source/ui/dlg/prltempl.cxx
+++ b/sd/source/ui/dlg/prltempl.cxx
@@ -37,7 +37,7 @@
#include <svl/intitem.hxx>
#include <svx/flagsdef.hxx>
-#define IS_OUTLINE(x) (x >= PO_OUTLINE_1 && x <= PO_OUTLINE_9)
+#define IS_OUTLINE(x) (x >= PresentationObjects::Outline_1 && x <= PresentationObjects::Outline_9)
/**
* Constructor of Tab dialog: appends pages to the dialog
@@ -171,36 +171,36 @@ SdPresLayoutTemplateDlg::SdPresLayoutTemplateDlg(SfxObjectShell const * pDocSh,
switch( ePO )
{
- case PO_TITLE:
+ case PresentationObjects::Title:
aTitle = SdResId(STR_PSEUDOSHEET_TITLE);
break;
- case PO_SUBTITLE:
+ case PresentationObjects::Subtitle:
aTitle = SdResId(STR_PSEUDOSHEET_SUBTITLE);
break;
- case PO_BACKGROUND:
+ case PresentationObjects::Background:
aTitle = SdResId(STR_PSEUDOSHEET_BACKGROUND);
break;
- case PO_BACKGROUNDOBJECTS:
+ case PresentationObjects::BackgroundObjects:
aTitle = SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS);
break;
- case PO_OUTLINE_1:
- case PO_OUTLINE_2:
- case PO_OUTLINE_3:
- case PO_OUTLINE_4:
- case PO_OUTLINE_5:
- case PO_OUTLINE_6:
- case PO_OUTLINE_7:
- case PO_OUTLINE_8:
- case PO_OUTLINE_9:
+ case PresentationObjects::Outline_1:
+ case PresentationObjects::Outline_2:
+ case PresentationObjects::Outline_3:
+ case PresentationObjects::Outline_4:
+ case PresentationObjects::Outline_5:
+ case PresentationObjects::Outline_6:
+ case PresentationObjects::Outline_7:
+ case PresentationObjects::Outline_8:
+ case PresentationObjects::Outline_9:
aTitle = SdResId(STR_PSEUDOSHEET_OUTLINE) + " " +
- OUString::number( ePO - PO_OUTLINE_1 + 1 );
+ OUString::number( static_cast<int>(ePO) - static_cast<int>(PresentationObjects::Outline_1) + 1 );
break;
- case PO_NOTES:
+ case PresentationObjects::Notes:
aTitle = SdResId(STR_PSEUDOSHEET_NOTES);
break;
}
@@ -289,15 +289,15 @@ sal_uInt16 SdPresLayoutTemplateDlg::GetOutlineLevel() const
{
switch( ePO )
{
- case PO_OUTLINE_1: return 0;
- case PO_OUTLINE_2: return 1;
- case PO_OUTLINE_3: return 2;
- case PO_OUTLINE_4: return 3;
- case PO_OUTLINE_5: return 4;
- case PO_OUTLINE_6: return 5;
- case PO_OUTLINE_7: return 6;
- case PO_OUTLINE_8: return 7;
- case PO_OUTLINE_9: return 8;
+ case PresentationObjects::Outline_1: return 0;
+ case PresentationObjects::Outline_2: return 1;
+ case PresentationObjects::Outline_3: return 2;
+ case PresentationObjects::Outline_4: return 3;
+ case PresentationObjects::Outline_5: return 4;
+ case PresentationObjects::Outline_6: return 5;
+ case PresentationObjects::Outline_7: return 6;
+ case PresentationObjects::Outline_8: return 7;
+ case PresentationObjects::Outline_9: return 8;
default:
SAL_WARN( "sd", "Wrong Po! [CL]");
}
diff --git a/sd/source/ui/func/fuprobjs.cxx b/sd/source/ui/func/fuprobjs.cxx
index cabd3cff40fc..0edd726251e6 100644
--- a/sd/source/ui/func/fuprobjs.cxx
+++ b/sd/source/ui/func/fuprobjs.cxx
@@ -116,12 +116,12 @@ void FuPresentationObjects::DoExecute( SfxRequest& )
if( bPage )
{
- ePO = PO_TITLE;
+ ePO = PresentationObjects::Title;
aStyleName += STR_LAYOUT_TITLE;
}
else
{
- ePO = static_cast<PresentationObjects>( PO_OUTLINE_1 + nDepth - 1 );
+ ePO = static_cast<PresentationObjects>( static_cast<int>(PresentationObjects::Outline_1) + nDepth - 1 );
aStyleName += STR_LAYOUT_OUTLINE " "
+ OUString::number(nDepth);
}
diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx
index ad6651453c9a..a1d376e13622 100644
--- a/sd/source/ui/func/futempl.cxx
+++ b/sd/source/ui/func/futempl.cxx
@@ -287,7 +287,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
case SID_STYLE_NEW:
case SID_STYLE_EDIT:
{
- PresentationObjects ePO = PO_OUTLINE_1;
+ PresentationObjects ePO = PresentationObjects::Outline_1;
if( pStyleSheet )
{
@@ -309,27 +309,27 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
if (aName == SdResId(STR_PSEUDOSHEET_TITLE))
{
- ePO = PO_TITLE;
+ ePO = PresentationObjects::Title;
}
else if (aName == SdResId(STR_PSEUDOSHEET_SUBTITLE))
{
- ePO = PO_SUBTITLE;
+ ePO = PresentationObjects::Subtitle;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_BACKGROUND))
{
bBackground = true;
- ePO = PO_BACKGROUND;
+ ePO = PresentationObjects::Background;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_BACKGROUNDOBJECTS))
{
- ePO = PO_BACKGROUNDOBJECTS;
+ ePO = PresentationObjects::BackgroundObjects;
}
else if (aName ==
SdResId(STR_PSEUDOSHEET_NOTES))
{
- ePO = PO_NOTES;
+ ePO = PresentationObjects::Notes;
}
else if(aName.indexOf(SdResId(STR_PSEUDOSHEET_OUTLINE)) != -1)
{
@@ -339,15 +339,15 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
sal_uInt16 nLevel = static_cast<sal_uInt16>(aNumStr.toInt32());
switch (nLevel)
{
- case 1: ePO = PO_OUTLINE_1; break;
- case 2: ePO = PO_OUTLINE_2; break;
- case 3: ePO = PO_OUTLINE_3; break;
- case 4: ePO = PO_OUTLINE_4; break;
- case 5: ePO = PO_OUTLINE_5; break;
- case 6: ePO = PO_OUTLINE_6; break;
- case 7: ePO = PO_OUTLINE_7; break;
- case 8: ePO = PO_OUTLINE_8; break;
- case 9: ePO = PO_OUTLINE_9; break;
+ case 1: ePO = PresentationObjects::Outline_1; break;
+ case 2: ePO = PresentationObjects::Outline_2; break;
+ case 3: ePO = PresentationObjects::Outline_3; break;
+ case 4: ePO = PresentationObjects::Outline_4; break;
+ case 5: ePO = PresentationObjects::Outline_5; break;
+ case 6: ePO = PresentationObjects::Outline_6; break;
+ case 7: ePO = PresentationObjects::Outline_7; break;
+ case 8: ePO = PresentationObjects::Outline_8; break;
+ case 9: ePO = PresentationObjects::Outline_9; break;
}
}
else
@@ -402,7 +402,7 @@ void FuTemplate::DoExecute( SfxRequest& rReq )
aTempSet.ClearInvalidItems();
// EE_PARA_NUMBULLET item is only valid in first outline template
- if( (ePO >= PO_OUTLINE_2) && (ePO <= PO_OUTLINE_9) )
+ if( (ePO >= PresentationObjects::Outline_2) && (ePO <= PresentationObjects::Outline_9) )
{
if (aTempSet.GetItemState(EE_PARA_NUMBULLET) == SfxItemState::SET)
{
diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx
index 24c05c105a42..4d1346a123c2 100644
--- a/sd/source/ui/view/drtxtob1.cxx
+++ b/sd/source/ui/view/drtxtob1.cxx
@@ -492,7 +492,7 @@ void TextObjectBar::Execute( SfxRequest &rReq )
pFirstStyleSheet->GetItemSet().Put(SvxNumBulletItem(aNewRule, EE_PARA_NUMBULLET));
- SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PO_OUTLINE_1, pSSPool);
+ SdStyleSheet::BroadcastSdStyleSheetChange(pFirstStyleSheet, PresentationObjects::Outline_1, pSSPool);
}
}
}
More information about the Libreoffice-commits
mailing list