summaryrefslogtreecommitdiff
path: root/sw/source/uibase/inc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-09-13 13:00:36 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-09-14 06:19:20 +0000
commitcb45d0d4272da54f90cb2b03d2cdbe1a4eebc75c (patch)
treee3bfd003052ed1d0d86ea853c88cf0fc470ff0ec /sw/source/uibase/inc
parent2c93e16d65e486524e4d066d68fddcaa5811078b (diff)
convert CONTENT_TYPE to scoped enum
Change-Id: I84b6d595f3997207385355f2bb3a9b64e6c9977b Reviewed-on: https://gerrit.libreoffice.org/18536 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sw/source/uibase/inc')
-rw-r--r--sw/source/uibase/inc/content.hxx6
-rw-r--r--sw/source/uibase/inc/conttree.hxx13
-rw-r--r--sw/source/uibase/inc/navicfg.hxx19
-rw-r--r--sw/source/uibase/inc/swcont.hxx30
4 files changed, 37 insertions, 31 deletions
diff --git a/sw/source/uibase/inc/content.hxx b/sw/source/uibase/inc/content.hxx
index adcb3f799527..10cfa93bcb80 100644
--- a/sw/source/uibase/inc/content.hxx
+++ b/sw/source/uibase/inc/content.hxx
@@ -156,7 +156,7 @@ class SwContentType : public SwTypeNumber
OUString sSingleContentTypeName; // name of content type, singular
OUString sTypeToken; // attachment for URL
size_t nMemberCount; // content count
- sal_uInt16 nContentType; // content type's Id
+ ContentTypeId nContentType; // content type's Id
sal_uInt8 nOutlineLevel;
bool bDataValid : 1;
bool bEdit: 1; // can this type be edited?
@@ -164,14 +164,14 @@ class SwContentType : public SwTypeNumber
protected:
static OUString RemoveNewline(const OUString&);
public:
- SwContentType(SwWrtShell* pParent, sal_uInt16 nType, sal_uInt8 nLevel );
+ SwContentType(SwWrtShell* pParent, ContentTypeId nType, sal_uInt8 nLevel );
virtual ~SwContentType();
void Init(bool* pbInvalidateWindow = 0);
void FillMemberList(bool* pbLevelChanged = NULL);
size_t GetMemberCount() const
{return nMemberCount;};
- sal_uInt16 GetType() const {return nContentType;}
+ ContentTypeId GetType() const {return nContentType;}
const SwContent* GetMember(size_t nIndex);
const OUString& GetName() {return sContentTypeName;}
const OUString& GetSingleName() const {return sSingleContentTypeName;}
diff --git a/sw/source/uibase/inc/conttree.hxx b/sw/source/uibase/inc/conttree.hxx
index aa6ff6b9ef4c..72728761a181 100644
--- a/sw/source/uibase/inc/conttree.hxx
+++ b/sw/source/uibase/inc/conttree.hxx
@@ -25,6 +25,7 @@
#include "swcont.hxx"
#include <map>
+#include <o3tl/enumarray.hxx>
class SwWrtShell;
class SwContentType;
@@ -52,8 +53,8 @@ class SwContentTree
OUString sSpace;
AutoTimer aUpdTimer;
- SwContentType* aActiveContentArr[CONTENT_TYPE_MAX];
- SwContentType* aHiddenContentArr[CONTENT_TYPE_MAX];
+ o3tl::enumarray<ContentTypeId,SwContentType*> aActiveContentArr;
+ o3tl::enumarray<ContentTypeId,SwContentType*> aHiddenContentArr;
OUString aContextStrings[CONTEXT_COUNT + 1];
OUString sRemoveIdx;
OUString sUpdateIdx;
@@ -73,9 +74,9 @@ class SwContentTree
sal_Int32 nActiveBlock;
sal_Int32 nHiddenBlock;
- sal_uInt16 nRootType;
- sal_uInt16 nLastSelType;
- sal_uInt8 nOutlineLevel;
+ ContentTypeId nRootType;
+ ContentTypeId nLastSelType;
+ sal_uInt8 nOutlineLevel;
bool bIsActive :1;
bool bIsConstant :1;
@@ -150,7 +151,7 @@ public:
SdrObject* GetDrawingObjectsByContent(const SwContent *pCnt);
bool ToggleToRoot();
- void SetRootType(sal_uInt16 nType);
+ void SetRootType(ContentTypeId nType);
void Display( bool bActiveView );
void Clear();
void SetHiddenShell(SwWrtShell* pSh);
diff --git a/sw/source/uibase/inc/navicfg.hxx b/sw/source/uibase/inc/navicfg.hxx
index d148c079510c..4859a5682b13 100644
--- a/sw/source/uibase/inc/navicfg.hxx
+++ b/sw/source/uibase/inc/navicfg.hxx
@@ -22,16 +22,17 @@
#include <unotools/configitem.hxx>
enum class RegionMode;
+enum class ContentTypeId;
class SwNavigationConfig : public utl::ConfigItem
{
- sal_Int32 nRootType; //RootType
- sal_Int32 nSelectedPos; //SelectedPosition
- sal_Int32 nOutlineLevel; //OutlineLevel
- RegionMode nRegionMode; //InsertMode
- sal_Int32 nActiveBlock; //ActiveBlock//Expand/CollapsState
- bool bIsSmall; //ShowListBox
- bool bIsGlobalActive; //GlobalDocMode// global view for GlobalDoc valid?
+ ContentTypeId nRootType; //RootType
+ sal_Int32 nSelectedPos; //SelectedPosition
+ sal_Int32 nOutlineLevel; //OutlineLevel
+ RegionMode nRegionMode; //InsertMode
+ sal_Int32 nActiveBlock; //ActiveBlock//Expand/CollapsState
+ bool bIsSmall; //ShowListBox
+ bool bIsGlobalActive; //GlobalDocMode// global view for GlobalDoc valid?
static com::sun::star::uno::Sequence<OUString> GetPropertyNames();
@@ -43,8 +44,8 @@ public:
virtual void Notify( const ::com::sun::star::uno::Sequence< OUString >& aPropertyNames ) SAL_OVERRIDE;
- sal_Int32 GetRootType()const {return nRootType;}
- void SetRootType(sal_Int32 nSet){
+ ContentTypeId GetRootType()const {return nRootType;}
+ void SetRootType(ContentTypeId nSet){
if(nRootType != nSet)
{
SetModified();
diff --git a/sw/source/uibase/inc/swcont.hxx b/sw/source/uibase/inc/swcont.hxx
index 8eecba29063b..153661b1e89b 100644
--- a/sw/source/uibase/inc/swcont.hxx
+++ b/sw/source/uibase/inc/swcont.hxx
@@ -26,19 +26,23 @@
class SwContentType;
// synchronize order and number with ResIds!!
-#define CONTENT_TYPE_OUTLINE 0
-#define CONTENT_TYPE_TABLE 1
-#define CONTENT_TYPE_FRAME 2
-#define CONTENT_TYPE_GRAPHIC 3
-#define CONTENT_TYPE_OLE 4
-#define CONTENT_TYPE_BOOKMARK 5
-#define CONTENT_TYPE_REGION 6
-#define CONTENT_TYPE_URLFIELD 7
-#define CONTENT_TYPE_REFERENCE 8
-#define CONTENT_TYPE_INDEX 9
-#define CONTENT_TYPE_POSTIT 10
-#define CONTENT_TYPE_DRAWOBJECT 11
-#define CONTENT_TYPE_MAX CONTENT_TYPE_DRAWOBJECT +1
+enum class ContentTypeId
+{
+ OUTLINE = 0,
+ TABLE = 1,
+ FRAME = 2,
+ GRAPHIC = 3,
+ OLE = 4,
+ BOOKMARK = 5,
+ REGION = 6,
+ URLFIELD = 7,
+ REFERENCE = 8,
+ INDEX = 9,
+ POSTIT = 10,
+ DRAWOBJECT = 11,
+ LAST = DRAWOBJECT,
+ UNKNOWN = USHRT_MAX
+};
// strings for context menus
#define CONTEXT_COUNT 12