diff options
Diffstat (limited to 'sw/inc')
-rw-r--r-- | sw/inc/crsrsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 2 | ||||
-rw-r--r-- | sw/inc/ndgrf.hxx | 4 | ||||
-rw-r--r-- | sw/inc/ndnotxt.hxx | 6 | ||||
-rw-r--r-- | sw/inc/ndole.hxx | 4 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 4 | ||||
-rw-r--r-- | sw/inc/ndtyp.hxx | 27 | ||||
-rw-r--r-- | sw/inc/node.hxx | 52 |
8 files changed, 54 insertions, 47 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index ca5a77279b0a..10e13a101e0a 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -188,7 +188,7 @@ private: long m_nLeftFramePos; sal_uLong m_nAktNode; // save CursorPos at Start-Action sal_Int32 m_nAktContent; - sal_uInt16 m_nAktNdTyp; + SwNodeType m_nAktNdTyp; bool m_bAktSelection; /* diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 90ec57051f12..175dc6eca1c7 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -715,7 +715,7 @@ public: std::set<SwRootFrame*> GetAllLayouts(); void SetFlyName( SwFlyFrameFormat& rFormat, const OUString& rName ); - const SwFlyFrameFormat* FindFlyByName( const OUString& rName, sal_Int8 nNdTyp = 0 ) const; + const SwFlyFrameFormat* FindFlyByName( const OUString& rName, SwNodeType nNdTyp = SwNodeType::NONE ) const; static void GetGrfNms( const SwFlyFrameFormat& rFormat, OUString* pGrfName, OUString* pFltName ); diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx index 3c5d209faf67..5dac38a4dfdc 100644 --- a/sw/inc/ndgrf.hxx +++ b/sw/inc/ndgrf.hxx @@ -206,12 +206,12 @@ public: // Inline methods from Node.hxx - it is only now that we know TextNode!! inline SwGrfNode *SwNode::GetGrfNode() { - return ND_GRFNODE == m_nNodeType ? static_cast<SwGrfNode*>(this) : nullptr; + return SwNodeType::Grf == m_nNodeType ? static_cast<SwGrfNode*>(this) : nullptr; } inline const SwGrfNode *SwNode::GetGrfNode() const { - return ND_GRFNODE == m_nNodeType ? static_cast<const SwGrfNode*>(this) : nullptr; + return SwNodeType::Grf == m_nNodeType ? static_cast<const SwGrfNode*>(this) : nullptr; } inline bool SwGrfNode::IsLinkedFile() const diff --git a/sw/inc/ndnotxt.hxx b/sw/inc/ndnotxt.hxx index 69347e9c7eb0..7ba253e564b5 100644 --- a/sw/inc/ndnotxt.hxx +++ b/sw/inc/ndnotxt.hxx @@ -45,7 +45,7 @@ class SW_DLLPUBLIC SwNoTextNode : public SwContentNode SwNoTextNode &operator=( const SwNoTextNode& ) = delete; protected: - SwNoTextNode( const SwNodeIndex &rWhere, const sal_uInt8 nNdType, + SwNoTextNode( const SwNodeIndex &rWhere, const SwNodeType nNdType, SwGrfFormatColl *pGrColl, SwAttrSet* pAutoAttr ); public: @@ -93,11 +93,11 @@ public: // Inline methods from Node.hxx - we know TextNode only here!! inline SwNoTextNode *SwNode::GetNoTextNode() { - return ND_NOTXTNODE & m_nNodeType ? static_cast<SwNoTextNode*>(this) : nullptr; + return SwNodeType::NoTextMask & m_nNodeType ? static_cast<SwNoTextNode*>(this) : nullptr; } inline const SwNoTextNode *SwNode::GetNoTextNode() const { - return ND_NOTXTNODE & m_nNodeType ? static_cast<const SwNoTextNode*>(this) : nullptr; + return SwNodeType::NoTextMask & m_nNodeType ? static_cast<const SwNoTextNode*>(this) : nullptr; } #endif // INCLUDED_SW_INC_NDNOTXT_HXX diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx index 28d427ddc022..c878689b78eb 100644 --- a/sw/inc/ndole.hxx +++ b/sw/inc/ndole.hxx @@ -153,12 +153,12 @@ public: /// Inline methods from Node.hxx inline SwOLENode *SwNode::GetOLENode() { - return ND_OLENODE == m_nNodeType ? static_cast<SwOLENode*>(this) : nullptr; + return SwNodeType::Ole == m_nNodeType ? static_cast<SwOLENode*>(this) : nullptr; } inline const SwOLENode *SwNode::GetOLENode() const { - return ND_OLENODE == m_nNodeType ? static_cast<const SwOLENode*>(this) : nullptr; + return SwNodeType::Ole == m_nNodeType ? static_cast<const SwOLENode*>(this) : nullptr; } #endif // _ INCLUDED_SW_INC_NDOLE_HXX diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 87f4a7b28e81..6bbaf2e7a243 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -833,12 +833,12 @@ inline SwTextFormatColl* SwTextNode::GetTextColl() const /// Inline methods from Node.hxx inline SwTextNode *SwNode::GetTextNode() { - return ND_TEXTNODE == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr; + return SwNodeType::Text == m_nNodeType ? static_cast<SwTextNode*>(this) : nullptr; } inline const SwTextNode *SwNode::GetTextNode() const { - return ND_TEXTNODE == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr; + return SwNodeType::Text == m_nNodeType ? static_cast<const SwTextNode*>(this) : nullptr; } inline void diff --git a/sw/inc/ndtyp.hxx b/sw/inc/ndtyp.hxx index 081ccadf1637..6e1909bdf721 100644 --- a/sw/inc/ndtyp.hxx +++ b/sw/inc/ndtyp.hxx @@ -21,22 +21,29 @@ #define INCLUDED_SW_INC_NDTYP_HXX #include <tools/solar.h> +#include <o3tl/typed_flags_set.hxx> // IDs for different nodes. The member indicating the type of node is // in base class. -const sal_uInt8 ND_ENDNODE = 0x01; -const sal_uInt8 ND_STARTNODE = 0x02; -const sal_uInt8 ND_TABLENODE = 0x04 | ND_STARTNODE; ///< SwTableNode is derived from SwStartNode. -const sal_uInt8 ND_TEXTNODE = 0x08; -const sal_uInt8 ND_GRFNODE = 0x10; -const sal_uInt8 ND_OLENODE = 0x20; -const sal_uInt8 ND_SECTIONNODE = 0x40 | ND_STARTNODE; ///< SwSectionNode is derived from SwStartNode. -const sal_uInt8 ND_PLACEHOLDER = 0x80; +enum class SwNodeType : sal_uInt8 { + NONE = 0x00, + End = 0x01, + Start = 0x02, + Table = 0x04 | Start, ///< SwTableNode is derived from SwStartNode. + Text = 0x08, + Grf = 0x10, + Ole = 0x20, + Section = 0x40 | Start, ///< SwSectionNode is derived from SwStartNode. + PlaceHolder = 0x80, // NoTextNode (if any of the 2 bits are set). -const sal_uInt8 ND_NOTXTNODE = ND_GRFNODE | ND_OLENODE; + NoTextMask = Grf | Ole, // ContentNode (if any of the 3 bits are set). -const sal_uInt8 ND_CONTENTNODE = ND_TEXTNODE | ND_NOTXTNODE; + ContentMask = Text | NoTextMask, +}; +namespace o3tl { + template<> struct typed_flags<SwNodeType> : is_typed_flags<SwNodeType, 0xff> {}; +} // Special types of StartNodes that are not derivations but keep // "sections" together. diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 173f3d0d215f..f0ab99ff253d 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -82,7 +82,7 @@ class SW_DLLPUBLIC SwNode { friend class SwNodes; - sal_uInt8 m_nNodeType; + SwNodeType m_nNodeType; /// For text nodes: level of auto format. Was put here because we had still free bits. sal_uInt8 m_nAFormatNumLvl : 3; @@ -102,10 +102,10 @@ class SW_DLLPUBLIC SwNode protected: SwStartNode* m_pStartOfSection; - SwNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeId ); + SwNode( const SwNodeIndex &rWhere, const SwNodeType nNodeId ); /// for the initial StartNode - SwNode( SwNodes& rNodes, sal_uLong nPos, const sal_uInt8 nNodeId ); + SwNode( SwNodes& rNodes, sal_uLong nPos, const SwNodeType nNodeId ); public: /** the = 0 forces the class to be an abstract base class, but the dtor can be still called @@ -134,7 +134,7 @@ public: inline bool IsIgnoreDontExpand() const { return m_bIgnoreDontExpand; } inline void SetIgnoreDontExpand( bool bNew ) { m_bIgnoreDontExpand = bNew; } - sal_uInt8 GetNodeType() const { return m_nNodeType; } + SwNodeType GetNodeType() const { return m_nNodeType; } inline SwStartNode *GetStartNode(); inline const SwStartNode *GetStartNode() const; @@ -311,7 +311,7 @@ class SwStartNode: public SwNode protected: SwStartNode( const SwNodeIndex &rWhere, - const sal_uInt8 nNodeType = ND_STARTNODE, + const SwNodeType nNodeType = SwNodeType::Start, SwStartNodeType = SwNormalStartNode ); public: DECL_FIXEDMEMPOOL_NEWDEL(SwStartNode) @@ -359,7 +359,7 @@ class SW_DLLPUBLIC SwContentNode: public SwModify, public SwNode, public SwIndex mutable bool mbSetModifyAtAttr; protected: - SwContentNode( const SwNodeIndex &rWhere, const sal_uInt8 nNodeType, + SwContentNode( const SwNodeIndex &rWhere, const SwNodeType nNodeType, SwFormatColl *pFormatColl ); /** the = 0 forces the class to be an abstract base class, but the dtor can be still called from subclasses */ @@ -585,80 +585,80 @@ private: inline SwEndNode *SwNode::GetEndNode() { - return ND_ENDNODE == m_nNodeType ? static_cast<SwEndNode*>(this) : nullptr; + return SwNodeType::End == m_nNodeType ? static_cast<SwEndNode*>(this) : nullptr; } inline const SwEndNode *SwNode::GetEndNode() const { - return ND_ENDNODE == m_nNodeType ? static_cast<const SwEndNode*>(this) : nullptr; + return SwNodeType::End == m_nNodeType ? static_cast<const SwEndNode*>(this) : nullptr; } inline SwStartNode *SwNode::GetStartNode() { - return ND_STARTNODE & m_nNodeType ? static_cast<SwStartNode*>(this) : nullptr; + return SwNodeType::Start & m_nNodeType ? static_cast<SwStartNode*>(this) : nullptr; } inline const SwStartNode *SwNode::GetStartNode() const { - return ND_STARTNODE & m_nNodeType ? static_cast<const SwStartNode*>(this) : nullptr; + return SwNodeType::Start & m_nNodeType ? static_cast<const SwStartNode*>(this) : nullptr; } inline SwTableNode *SwNode::GetTableNode() { - return ND_TABLENODE == m_nNodeType ? static_cast<SwTableNode*>(this) : nullptr; + return SwNodeType::Table == m_nNodeType ? static_cast<SwTableNode*>(this) : nullptr; } inline const SwTableNode *SwNode::GetTableNode() const { - return ND_TABLENODE == m_nNodeType ? static_cast<const SwTableNode*>(this) : nullptr; + return SwNodeType::Table == m_nNodeType ? static_cast<const SwTableNode*>(this) : nullptr; } inline SwSectionNode *SwNode::GetSectionNode() { - return ND_SECTIONNODE == m_nNodeType ? static_cast<SwSectionNode*>(this) : nullptr; + return SwNodeType::Section == m_nNodeType ? static_cast<SwSectionNode*>(this) : nullptr; } inline const SwSectionNode *SwNode::GetSectionNode() const { - return ND_SECTIONNODE == m_nNodeType ? static_cast<const SwSectionNode*>(this) : nullptr; + return SwNodeType::Section == m_nNodeType ? static_cast<const SwSectionNode*>(this) : nullptr; } inline SwContentNode *SwNode::GetContentNode() { - return ND_CONTENTNODE & m_nNodeType ? static_cast<SwContentNode*>(this) : nullptr; + return SwNodeType::ContentMask & m_nNodeType ? static_cast<SwContentNode*>(this) : nullptr; } inline const SwContentNode *SwNode::GetContentNode() const { - return ND_CONTENTNODE & m_nNodeType ? static_cast<const SwContentNode*>(this) : nullptr; + return SwNodeType::ContentMask & m_nNodeType ? static_cast<const SwContentNode*>(this) : nullptr; } inline bool SwNode::IsStartNode() const { - return (ND_STARTNODE & m_nNodeType) != 0; + return bool(SwNodeType::Start & m_nNodeType); } inline bool SwNode::IsContentNode() const { - return (ND_CONTENTNODE & m_nNodeType) != 0; + return bool(SwNodeType::ContentMask & m_nNodeType); } inline bool SwNode::IsEndNode() const { - return ND_ENDNODE == m_nNodeType; + return SwNodeType::End == m_nNodeType; } inline bool SwNode::IsTextNode() const { - return ND_TEXTNODE == m_nNodeType; + return SwNodeType::Text == m_nNodeType; } inline bool SwNode::IsTableNode() const { - return ND_TABLENODE == m_nNodeType; + return SwNodeType::Table == m_nNodeType; } inline bool SwNode::IsSectionNode() const { - return ND_SECTIONNODE == m_nNodeType; + return SwNodeType::Section == m_nNodeType; } inline bool SwNode::IsNoTextNode() const { - return (ND_NOTXTNODE & m_nNodeType) != 0; + return bool(SwNodeType::NoTextMask & m_nNodeType); } inline bool SwNode::IsOLENode() const { - return ND_OLENODE == m_nNodeType; + return SwNodeType::Ole == m_nNodeType; } inline bool SwNode::IsGrfNode() const { - return ND_GRFNODE == m_nNodeType; + return SwNodeType::Grf == m_nNodeType; } inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const @@ -737,7 +737,7 @@ inline const SfxPoolItem& SwContentNode::GetAttr( sal_uInt16 nWhich, } inline SwPlaceholderNode::SwPlaceholderNode(const SwNodeIndex &rWhere) - : SwNode(rWhere, ND_PLACEHOLDER) + : SwNode(rWhere, SwNodeType::PlaceHolder) { } |