summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2016-03-31 09:13:28 +0200
committerNoel Grandin <noel@peralex.com>2016-03-31 13:23:04 +0200
commit2cc5877a0cd08560478fe1f4206d7904e61e0557 (patch)
treebaa1a4cf00ef99f12ac44e259242c78902db6c82
parent81fbf1386a36972be7d3eff3f7a0c6bab80be764 (diff)
tdf#84938 convert INSERT_NUM_ constants to scoped enum
Change-Id: If5880558bb04a71ebc4ef76aa4f5aac3d10040f9
-rw-r--r--sw/source/uibase/inc/numberingtypelistbox.hxx20
-rw-r--r--sw/source/uibase/misc/numberingtypelistbox.cxx16
2 files changed, 22 insertions, 14 deletions
diff --git a/sw/source/uibase/inc/numberingtypelistbox.hxx b/sw/source/uibase/inc/numberingtypelistbox.hxx
index ce553db31d3f..965e32e6bc2e 100644
--- a/sw/source/uibase/inc/numberingtypelistbox.hxx
+++ b/sw/source/uibase/inc/numberingtypelistbox.hxx
@@ -21,12 +21,20 @@
#include <vcl/lstbox.hxx>
#include "swdllapi.h"
+#include <o3tl/typed_flags_set.hxx>
-#define INSERT_NUM_TYPE_NO_NUMBERING 0x01
-#define INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING 0x02
-#define INSERT_NUM_TYPE_BITMAP 0x04
-#define INSERT_NUM_TYPE_BULLET 0x08
-#define INSERT_NUM_EXTENDED_TYPES 0x10
+enum class SwInsertNumTypes
+{
+ NoNumbering = 0x01,
+ PageStyleNumbering = 0x02,
+ Bitmap = 0x04,
+ Bullet = 0x08,
+ Extended = 0x10
+};
+
+namespace o3tl {
+ template<> struct typed_flags<SwInsertNumTypes> : is_typed_flags<SwInsertNumTypes, 0x1f> {};
+};
struct SwNumberingTypeListBox_Impl;
@@ -41,7 +49,7 @@ public:
virtual bool set_property(const OString &rKey, const OString &rValue) override;
- void Reload(sal_uInt16 nTypeFlags);
+ void Reload(SwInsertNumTypes nTypeFlags);
sal_Int16 GetSelectedNumberingType();
bool SelectNumberingType(sal_Int16 nType);
diff --git a/sw/source/uibase/misc/numberingtypelistbox.cxx b/sw/source/uibase/misc/numberingtypelistbox.cxx
index faf6f3215eb4..a0eeb5182d17 100644
--- a/sw/source/uibase/misc/numberingtypelistbox.cxx
+++ b/sw/source/uibase/misc/numberingtypelistbox.cxx
@@ -49,7 +49,7 @@ SwNumberingTypeListBox::SwNumberingTypeListBox( vcl::Window* pWin, WinBits nStyl
bool SwNumberingTypeListBox::set_property(const OString &rKey, const OString &rValue)
{
if (rKey == "type")
- Reload(rValue.toInt32());
+ Reload(static_cast<SwInsertNumTypes>(rValue.toInt32()));
else
return ListBox::set_property(rKey, rValue);
return true;
@@ -74,12 +74,12 @@ void SwNumberingTypeListBox::dispose()
ListBox::dispose();
}
-void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags)
+void SwNumberingTypeListBox::Reload(SwInsertNumTypes nTypeFlags)
{
Clear();
uno::Sequence<sal_Int16> aTypes;
const sal_Int16* pTypes = nullptr;
- if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) )
+ if(nTypeFlags & SwInsertNumTypes::Extended)
{
if(pImpl->xInfo.is())
{
@@ -97,20 +97,20 @@ void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags)
switch(nValue)
{
case style::NumberingType::NUMBER_NONE:
- bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_NO_NUMBERING);
+ bInsert = bool(nTypeFlags & SwInsertNumTypes::NoNumbering);
nPos = 0;
break;
case style::NumberingType::CHAR_SPECIAL:
- bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BULLET);
+ bInsert = bool(nTypeFlags & SwInsertNumTypes::Bullet);
break;
case style::NumberingType::PAGE_DESCRIPTOR:
- bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_PAGE_STYLE_NUMBERING);
+ bInsert = bool(nTypeFlags & SwInsertNumTypes::PageStyleNumbering);
break;
case style::NumberingType::BITMAP:
- bInsert = 0 != (nTypeFlags&INSERT_NUM_TYPE_BITMAP );
+ bInsert = bool(nTypeFlags & SwInsertNumTypes::Bitmap );
break;
default:
@@ -137,7 +137,7 @@ void SwNumberingTypeListBox::Reload(sal_uInt16 nTypeFlags)
SetEntryData( nEntry, reinterpret_cast<void*>(nValue) );
}
}
- if(0 != (nTypeFlags&INSERT_NUM_EXTENDED_TYPES) )
+ if(nTypeFlags & SwInsertNumTypes::Extended)
{
if(pTypes)
{