diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2016-03-30 22:25:26 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-03-31 13:23:03 +0200 |
commit | e15299b327734a622cab29bd682803a86b5a8c9e (patch) | |
tree | ee75f3c1ad1d802ef68318c2f8b4b35dab487a2d | |
parent | 77a5c97418112127ce8adb5aa902b7c5b7d8c3c3 (diff) |
tdf#84938 convert FRM_ constants to scoped enum
Change-Id: I785d154a5df9a33b7d513dee1d3d859e5e800e7a
35 files changed, 212 insertions, 192 deletions
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index abeb69f24e17..fb8f434808a0 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1884,19 +1884,19 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, SwAccessibleContext *pAcc = nullptr; switch( pFrame->GetType() ) { - case FRM_TXT: + case SwFrameType::Txt: pAcc = new SwAccessibleParagraph( this, static_cast< const SwTextFrame& >( *pFrame ) ); break; - case FRM_HEADER: + case SwFrameType::Header: pAcc = new SwAccessibleHeaderFooter( this, static_cast< const SwHeaderFrame *>( pFrame ) ); break; - case FRM_FOOTER: + case SwFrameType::Footer: pAcc = new SwAccessibleHeaderFooter( this, static_cast< const SwFooterFrame *>( pFrame ) ); break; - case FRM_FTN: + case SwFrameType::Ftn: { const SwFootnoteFrame *pFootnoteFrame = static_cast < const SwFootnoteFrame * >( pFrame ); @@ -1907,7 +1907,7 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, pFootnoteFrame ); } break; - case FRM_FLY: + case SwFrameType::Fly: { const SwFlyFrame *pFlyFrame = static_cast < const SwFlyFrame * >( pFrame ); @@ -1925,19 +1925,20 @@ uno::Reference< XAccessible> SwAccessibleMap::GetContext( const SwFrame *pFrame, } } break; - case FRM_CELL: + case SwFrameType::Cell: pAcc = new SwAccessibleCell( this, static_cast< const SwCellFrame *>( pFrame ) ); break; - case FRM_TAB: + case SwFrameType::Tab: pAcc = new SwAccessibleTable( this, static_cast< const SwTabFrame *>( pFrame ) ); break; - case FRM_PAGE: + case SwFrameType::Page: OSL_ENSURE( GetShell()->IsPreview(), "accessible page frames only in PagePreview" ); pAcc = new SwAccessiblePage( this, pFrame ); break; + default: break; } xAcc = pAcc; @@ -2467,16 +2468,14 @@ so run here: save the parent's SwFrame not the accessible object parent, bool bIsTextParent = false; if (aFrameOrObj.GetSwFrame()) { - int nType = pFrame->GetType(); - if ( FRM_FLY == nType ) + if (SwFrameType::Fly == pFrame->GetType()) { bIsValidFrame =true; } } else if(pObj) { - int nType = pParent->GetType(); - if (FRM_TXT == nType) + if (SwFrameType::Txt == pParent->GetType()) { bIsTextParent =true; } diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 70ee4cc305fc..c8256388fd6c 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1836,7 +1836,7 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( while ( pUpperFrame ) { if ( pUpperFrame->GetType() & - ( FRM_PAGE | FRM_FLY | FRM_SECTION | FRM_TAB | FRM_CELL ) ) + ( SwFrameType::Page | SwFrameType::Fly | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Cell ) ) { if ( pUpperFrame->IsVertical() ) { diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index e93a6c9d7014..de9853bc94b6 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -93,7 +93,7 @@ static void lcl_notifyRow(const SwContentNode* pNode, SwCursorShell& rShell) { for (SwFrame *pContent = pCell->GetLower(); pContent; pContent = pContent->GetNext()) { - if (pContent->GetType() == FRM_TAB) + if (pContent->GetType() == SwFrameType::Tab) { SwFormatFrameSize pSize = pLine->GetFrameFormat()->GetFrameSize(); pRow->ModifyNotification(nullptr, &pSize); diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx index 19d7a792fa3c..86a555eeac2b 100644 --- a/sw/source/core/doc/notxtfrm.cxx +++ b/sw/source/core/doc/notxtfrm.cxx @@ -152,7 +152,7 @@ SwNoTextFrame::SwNoTextFrame(SwNoTextNode * const pNode, SwFrame* pSib ) /// Initialization: Currently add the Frame to the Cache void SwNoTextFrame::InitCtor() { - mnFrameType = FRM_NOTXT; + mnFrameType = SwFrameType::NoTxt; } SwContentFrame *SwNoTextNode::MakeFrame( SwFrame* pSib ) diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index f326ccb102d8..d330f25a5292 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -415,7 +415,7 @@ SwFrame* SwNode2LayImpl::GetFrame( const Point* pDocPos, const SwPosition *pPos ) const { // test if change of member pIter -> pMod broke anything - return pMod ? ::GetFrameOfModify( nullptr, *pMod, USHRT_MAX, pDocPos, pPos ) : nullptr; + return pMod ? ::GetFrameOfModify( nullptr, *pMod, FRM_ALL, pDocPos, pPos ) : nullptr; } SwNode2Layout::SwNode2Layout( const SwNode& rNd, sal_uLong nIdx ) diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 3f65157233c0..ada742b128d2 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -138,8 +138,8 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, // different frames, check their Y-/X-position bool bRefIsLower = false; - if( ( FRM_COLUMN | FRM_CELL ) & pFieldFrame->GetType() || - ( FRM_COLUMN | FRM_CELL ) & pRefFrame->GetType() ) + if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() || + ( SwFrameType::Column | SwFrameType::Cell ) & pRefFrame->GetType() ) { if( pFieldFrame->GetType() == pRefFrame->GetType() ) { @@ -165,7 +165,7 @@ bool IsFrameBehind( const SwTextNode& rMyNd, sal_Int32 nMySttPos, pRefFrame->Frame().Top() < pFieldFrame->Frame().Top() ); pRefFrame = nullptr; } - else if( ( FRM_COLUMN | FRM_CELL ) & pFieldFrame->GetType() ) + else if( ( SwFrameType::Column | SwFrameType::Cell ) & pFieldFrame->GetType() ) pFieldFrame = aArr[ nCnt - 1 ]; else pRefFrame = aRefArr[ nRefCnt - 1 ]; diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 35bf7b50aaf9..d3cbf43758c1 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -226,7 +226,7 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons { switch ( pFrame->GetType() ) { - case FRM_COLUMN: if( pFrame->GetUpper()->IsSctFrame() ) + case SwFrameType::Column: if( pFrame->GetUpper()->IsSctFrame() ) { // Check, if isn't not only a single column // from a section with footnotes at the end. @@ -238,17 +238,17 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons else // only pages and frame columns nReturn |= FrameTypeFlags::COLUMN; break; - case FRM_PAGE: nReturn |= FrameTypeFlags::PAGE; + case SwFrameType::Page: nReturn |= FrameTypeFlags::PAGE; if( static_cast<const SwPageFrame*>(pFrame)->IsFootnotePage() ) nReturn |= FrameTypeFlags::FTNPAGE; break; - case FRM_HEADER: nReturn |= FrameTypeFlags::HEADER; break; - case FRM_FOOTER: nReturn |= FrameTypeFlags::FOOTER; break; - case FRM_BODY: if( pFrame->GetUpper()->IsPageFrame() ) // not for ColumnFrames + case SwFrameType::Header: nReturn |= FrameTypeFlags::HEADER; break; + case SwFrameType::Footer: nReturn |= FrameTypeFlags::FOOTER; break; + case SwFrameType::Body: if( pFrame->GetUpper()->IsPageFrame() ) // not for ColumnFrames nReturn |= FrameTypeFlags::BODY; break; - case FRM_FTN: nReturn |= FrameTypeFlags::FOOTNOTE; break; - case FRM_FLY: if( static_cast<const SwFlyFrame*>(pFrame)->IsFlyLayFrame() ) + case SwFrameType::Ftn: nReturn |= FrameTypeFlags::FOOTNOTE; break; + case SwFrameType::Fly: if( static_cast<const SwFlyFrame*>(pFrame)->IsFlyLayFrame() ) nReturn |= FrameTypeFlags::FLY_FREE; else if ( static_cast<const SwFlyFrame*>(pFrame)->IsFlyAtContentFrame() ) nReturn |= FrameTypeFlags::FLY_ATCNT; @@ -262,9 +262,9 @@ FrameTypeFlags SwFEShell::GetFrameType( const Point *pPt, bool bStopAtFly ) cons if( bStopAtFly ) return nReturn; break; - case FRM_TAB: - case FRM_ROW: - case FRM_CELL: nReturn |= FrameTypeFlags::TABLE; break; + case SwFrameType::Tab: + case SwFrameType::Row: + case SwFrameType::Cell: nReturn |= FrameTypeFlags::TABLE; break; default: /* do nothing */ break; } if ( pFrame->IsFlyFrame() ) @@ -613,7 +613,7 @@ sal_uInt16 SwFEShell::_GetCurColNum( const SwFrame *pFrame, pFrame = pCurFrame->GetUpper(); while( pFrame ) { - if( ( FRM_PAGE | FRM_FLY | FRM_SECTION ) & pFrame->GetType() ) + if( ( SwFrameType::Page | SwFrameType::Fly | SwFrameType::Section ) & pFrame->GetType() ) { pPara->pFrameFormat = static_cast<const SwLayoutFrame*>(pFrame)->GetFormat(); pPara->pPrtRect = &pFrame->Prt(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index fdebdc725ed7..7d55fc04b6cc 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1527,12 +1527,12 @@ static void lcl_FindStartEndRow( const SwLayoutFrame *&rpStart, std::deque<const SwLayoutFrame *> aSttArr, aEndArr; const SwLayoutFrame *pTmp; - for( pTmp = rpStart; (FRM_CELL|FRM_ROW) & pTmp->GetType(); + for( pTmp = rpStart; (SwFrameType::Cell|SwFrameType::Row) & pTmp->GetType(); pTmp = pTmp->GetUpper() ) { aSttArr.push_front( pTmp ); } - for( pTmp = rpEnd; (FRM_CELL|FRM_ROW) & pTmp->GetType(); + for( pTmp = rpEnd; (SwFrameType::Cell|SwFrameType::Row) & pTmp->GetType(); pTmp = pTmp->GetUpper() ) { aEndArr.push_front( pTmp ); diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index 05abbf688ac5..57a48b9f57bd 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -28,6 +28,7 @@ #include "swrect.hxx" #include "calbck.hxx" #include <svl/SfxBroadcaster.hxx> +#include <o3tl/typed_flags_set.hxx> #include "IDocumentDrawModelAccess.hxx" #include <com/sun/star/style/TabStop.hpp> @@ -66,33 +67,42 @@ typedef struct _xmlTextWriter *xmlTextWriterPtr; // which kind of FrameType an instance is _and_ from what classes it was derived. // Each frame has in its base class a member that must be set by the // constructors accordingly. -#define FRM_ROOT 0x0001 -#define FRM_PAGE 0x0002 -#define FRM_COLUMN 0x0004 -#define FRM_HEADER 0x0008 -#define FRM_FOOTER 0x0010 -#define FRM_FTNCONT 0x0020 -#define FRM_FTN 0x0040 -#define FRM_BODY 0x0080 -#define FRM_FLY 0x0100 -#define FRM_SECTION 0x0200 -#define FRM_UNUSED 0x0400 -#define FRM_TAB 0x0800 -#define FRM_ROW 0x1000 -#define FRM_CELL 0x2000 -#define FRM_TXT 0x4000 -#define FRM_NOTXT 0x8000 +enum class SwFrameType +{ + None = 0x0000, + Root = 0x0001, + Page = 0x0002, + Column = 0x0004, + Header = 0x0008, + Footer = 0x0010, + FtnCont = 0x0020, + Ftn = 0x0040, + Body = 0x0080, + Fly = 0x0100, + Section = 0x0200, +// UNUSED 0x0400 + Tab = 0x0800, + Row = 0x1000, + Cell = 0x2000, + Txt = 0x4000, + NoTxt = 0x8000, +}; -// for internal use some common combinations -#define FRM_LAYOUT 0x3FFF -#define FRM_CNTNT 0xC000 -#define FRM_FTNBOSS 0x0006 -#define FRM_ACCESSIBLE (FRM_HEADER|FRM_FOOTER|FRM_FTN|FRM_TXT|FRM_ROOT|FRM_FLY|FRM_TAB|FRM_CELL|FRM_PAGE) +namespace o3tl +{ + template<> struct typed_flags<SwFrameType> : is_typed_flags<SwFrameType, 0xfbff> {}; +}; -#define FRM_NEIGHBOUR 0x2004 -#define FRM_NOTE_VERT 0x7a60 -#define FRM_HEADFOOT 0x0018 -#define FRM_BODYFTNC 0x00a0 +// for internal use some common combinations +#define FRM_LAYOUT SwFrameType(0x3bFF) +#define FRM_ALL SwFrameType(0xfbff) +#define FRM_CNTNT (SwFrameType::Txt | SwFrameType::NoTxt) +#define FRM_FTNBOSS (SwFrameType::Page | SwFrameType::Column) +#define FRM_ACCESSIBLE (SwFrameType::Root | SwFrameType::Page | SwFrameType::Header | SwFrameType::Footer | SwFrameType::Ftn | SwFrameType::Fly | SwFrameType::Tab | SwFrameType::Cell | SwFrameType::Txt) +#define FRM_NEIGHBOUR (SwFrameType::Column | SwFrameType::Cell) +#define FRM_NOTE_VERT (SwFrameType::FtnCont | SwFrameType::Ftn | SwFrameType::Section | SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | SwFrameType::Txt) +#define FRM_HEADFOOT (SwFrameType::Header | SwFrameType::Footer) +#define FRM_BODYFTNC (SwFrameType::FtnCont | SwFrameType::Body) // for GetNextLeaf/GetPrevLeaf. enum MakePageType @@ -224,7 +234,7 @@ protected: SwRect maFrame; // absolute position in document and size of the Frame SwRect maPrt; // position relatively to Frame and size of PrtArea - sal_uInt16 mnFrameType; //Who am I? + SwFrameType mnFrameType; //Who am I? bool mbReverse : 1; // Next line above/at the right side instead // under/at the left side of the previous line @@ -326,7 +336,7 @@ public: } - sal_uInt16 GetType() const { return mnFrameType; } + SwFrameType GetType() const { return mnFrameType; } static SwCache &GetCache() { return *mpCache; } static SwCache *GetCachePtr() { return mpCache; } @@ -729,7 +739,7 @@ public: void MakeLeftPos( const SwFrame*, const SwFrame*, bool ); void MakeRightPos( const SwFrame*, const SwFrame*, bool ); inline bool IsNeighbourFrame() const - { return (GetType() & FRM_NEIGHBOUR) != 0; } + { return bool(GetType() & FRM_NEIGHBOUR); } // #i65250# inline sal_uInt32 GetFrameId() const { return mnFrameId; } @@ -969,87 +979,87 @@ inline const SwFrame *SwFrame::FindPrev() const inline bool SwFrame::IsLayoutFrame() const { - return (GetType() & FRM_LAYOUT) != 0; + return bool(GetType() & FRM_LAYOUT); } inline bool SwFrame::IsRootFrame() const { - return mnFrameType == FRM_ROOT; + return mnFrameType == SwFrameType::Root; } inline bool SwFrame::IsPageFrame() const { - return mnFrameType == FRM_PAGE; + return mnFrameType == SwFrameType::Page; } inline bool SwFrame::IsColumnFrame() const { - return mnFrameType == FRM_COLUMN; + return mnFrameType == SwFrameType::Column; } inline bool SwFrame::IsFootnoteBossFrame() const { - return (GetType() & FRM_FTNBOSS) != 0; + return bool(GetType() & FRM_FTNBOSS); } inline bool SwFrame::IsHeaderFrame() const { - return mnFrameType == FRM_HEADER; + return mnFrameType == SwFrameType::Header; } inline bool SwFrame::IsFooterFrame() const { - return mnFrameType == FRM_FOOTER; + return mnFrameType == SwFrameType::Footer; } inline bool SwFrame::IsFootnoteContFrame() const { - return mnFrameType == FRM_FTNCONT; + return mnFrameType == SwFrameType::FtnCont; } inline bool SwFrame::IsFootnoteFrame() const { - return mnFrameType == FRM_FTN; + return mnFrameType == SwFrameType::Ftn; } inline bool SwFrame::IsBodyFrame() const { - return mnFrameType == FRM_BODY; + return mnFrameType == SwFrameType::Body; } inline bool SwFrame::IsFlyFrame() const { - return mnFrameType == FRM_FLY; + return mnFrameType == SwFrameType::Fly; } inline bool SwFrame::IsSctFrame() const { - return mnFrameType == FRM_SECTION; + return mnFrameType == SwFrameType::Section; } inline bool SwFrame::IsTabFrame() const { - return mnFrameType == FRM_TAB; + return mnFrameType == SwFrameType::Tab; } inline bool SwFrame::IsRowFrame() const { - return mnFrameType == FRM_ROW; + return mnFrameType == SwFrameType::Row; } inline bool SwFrame::IsCellFrame() const { - return mnFrameType == FRM_CELL; + return mnFrameType == SwFrameType::Cell; } inline bool SwFrame::IsContentFrame() const { - return (GetType() & FRM_CNTNT) != 0; + return bool(GetType() & FRM_CNTNT); } inline bool SwFrame::IsTextFrame() const { - return mnFrameType == FRM_TXT; + return mnFrameType == SwFrameType::Txt; } inline bool SwFrame::IsNoTextFrame() const { - return mnFrameType == FRM_NOTXT; + return mnFrameType == SwFrameType::NoTxt; } inline bool SwFrame::IsFlowFrame() const { - return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION)) != 0; + return bool(GetType() & (FRM_CNTNT|SwFrameType::Tab|SwFrameType::Section)); } inline bool SwFrame::IsRetoucheFrame() const { - return (GetType() & (FRM_CNTNT|FRM_TAB|FRM_SECTION|FRM_FTN)) != 0; + return bool(GetType() & (FRM_CNTNT|SwFrameType::Tab|SwFrameType::Section|SwFrameType::Ftn)); } inline bool SwFrame::IsAccessibleFrame() const { - return (GetType() & FRM_ACCESSIBLE) != 0; + return bool(GetType() & FRM_ACCESSIBLE); } //use this to protect a SwFrame for a given scope from getting deleted diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx index 49fe70729742..b4fb47e84e06 100644 --- a/sw/source/core/inc/frmtool.hxx +++ b/sw/source/core/inc/frmtool.hxx @@ -146,7 +146,7 @@ const SwFrame* GetVirtualUpper( const SwFrame* pFrame, const Point& rPos ); bool Is_Lower_Of( const SwFrame *pCurrFrame, const SdrObject* pObj ); // FIXME: EasyHack (refactoring): rename method and parameter name in all files -const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalKontextTyp ); +const SwFrame *FindKontext( const SwFrame *pFrame, SwFrameType nAdditionalKontextTyp ); bool IsFrameInSameKontext( const SwFrame *pInnerFrame, const SwFrame *pFrame ); @@ -155,7 +155,7 @@ const SwFrame * FindPage( const SwRect &rRect, const SwFrame *pPage ); // used by SwContentNode::GetFrame and SwFlyFrame::GetFrame SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const&, - sal_uInt16 const nFrameType, + SwFrameType const nFrameType, const Point* = nullptr, const SwPosition *pPos = nullptr, const bool bCalcFrame = false ); diff --git a/sw/source/core/inc/hffrm.hxx b/sw/source/core/inc/hffrm.hxx index 9986df1e6846..5a823721c65d 100644 --- a/sw/source/core/inc/hffrm.hxx +++ b/sw/source/core/inc/hffrm.hxx @@ -31,7 +31,7 @@ protected: inline bool GetEatSpacing() const; // in hffrm.cxx public: - SwHeadFootFrame(SwFrameFormat * pFrame, SwFrame*, sal_uInt16 aType); + SwHeadFootFrame(SwFrameFormat * pFrame, SwFrame*, SwFrameType aType); virtual void Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttrs = nullptr ) override; virtual SwTwips GrowFrame( SwTwips, bool bTst = false, bool bInfo = false ) override; @@ -44,7 +44,7 @@ public: class SwHeaderFrame: public SwHeadFootFrame { public: - SwHeaderFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, FRM_HEADER) {}; + SwHeaderFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, SwFrameType::Header) {}; DECL_FIXEDMEMPOOL_NEWDEL(SwHeaderFrame) }; @@ -53,7 +53,7 @@ public: class SwFooterFrame: public SwHeadFootFrame { public: - SwFooterFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, FRM_FOOTER) {}; + SwFooterFrame( SwFrameFormat* pFrame, SwFrame* pSib ) : SwHeadFootFrame(pFrame, pSib, SwFrameType::Footer) {}; DECL_FIXEDMEMPOOL_NEWDEL(SwFooterFrame) }; diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx index 64e91e4cf514..ffcc8201bc7d 100644 --- a/sw/source/core/inc/layfrm.hxx +++ b/sw/source/core/inc/layfrm.hxx @@ -213,12 +213,12 @@ inline SwFrame* SwLayoutFrame::ContainsAny( const bool _bInvestigateFootnoteForS */ inline bool SwFrame::IsColBodyFrame() const { - return mnFrameType == FRM_BODY && GetUpper()->IsColumnFrame(); + return mnFrameType == SwFrameType::Body && GetUpper()->IsColumnFrame(); } inline bool SwFrame::IsPageBodyFrame() const { - return mnFrameType == FRM_BODY && GetUpper()->IsPageFrame(); + return mnFrameType == SwFrameType::Body && GetUpper()->IsPageFrame(); } inline SwFrame* SwLayoutFrame::GetLastLower() diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index eec52b9d5580..8ca9b78af87a 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -2684,7 +2684,7 @@ SwRect SwFrameFormat::FindLayoutRect( const bool bPrtArea, const Point* pPoint, } else { - const sal_uInt16 nFrameType = RES_FLYFRMFMT == Which() ? FRM_FLY : USHRT_MAX; + const SwFrameType nFrameType = RES_FLYFRMFMT == Which() ? SwFrameType::Fly : FRM_ALL; pFrame = ::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), nFrameType, pPoint, nullptr, bCalcFrame ); } @@ -2717,7 +2717,7 @@ SdrObject* SwFrameFormat::FindRealSdrObject() if( RES_FLYFRMFMT == Which() ) { Point aNullPt; - SwFlyFrame* pFly = static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, FRM_FLY, + SwFlyFrame* pFly = static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *this, SwFrameType::Fly, &aNullPt )); return pFly ? pFly->GetVirtDrawObj() : nullptr; } @@ -3037,7 +3037,7 @@ void SwFlyFrameFormat::MakeFrames() SwFlyFrame* SwFlyFrameFormat::GetFrame( const Point* pPoint, const bool bCalcFrame ) const { - return static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), FRM_FLY, + return static_cast<SwFlyFrame*>(::GetFrameOfModify( nullptr, *const_cast<SwModify*>(static_cast<SwModify const *>(this)), SwFrameType::Fly, pPoint, nullptr, bCalcFrame )); } @@ -3463,7 +3463,7 @@ bool IsFlyFrameFormatInHeader(const SwFrameFormat& rFormat) } SwPageFrame* pPageFrame = pFlyFrame->FindPageFrameOfAnchor(); SwFrame* pHeader = pPageFrame->Lower(); - if (pHeader->GetType() == FRM_HEADER) + if (pHeader->GetType() == SwFrameType::Header) { const SwFrame* pFrame = pFlyFrame->GetAnchorFrame(); while (pFrame) diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx index a5fd16c971b4..a69cb4a19545 100644 --- a/sw/source/core/layout/calcmove.cxx +++ b/sw/source/core/layout/calcmove.cxx @@ -491,7 +491,7 @@ void SwFrame::MakePos() } pPrv = lcl_Prev( this, false ); - const sal_uInt16 nMyType = GetType(); + const SwFrameType nMyType = GetType(); SWRECTFN( ( IsCellFrame() && GetUpper() ? GetUpper() : this ) ) if ( !bUseUpper && pPrv ) { @@ -507,7 +507,7 @@ void SwFrame::MakePos() (pPrv->Frame().*fnRect->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && FRM_CELL & nMyType && !mbReverse ) + if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } else if( bVert && FRM_NOTE_VERT & nMyType ) @@ -561,7 +561,7 @@ void SwFrame::MakePos() (pPrv->Frame().*fnRect->fnGetWidth)() ); // cells may now leave their uppers - if( bVert && FRM_CELL & nMyType && !mbReverse ) + if( bVert && SwFrameType::Cell & nMyType && !mbReverse ) maFrame.Pos().setX(maFrame.Pos().getX() - maFrame.Width() + pPrv->Frame().Width()); } else if( bVert && FRM_NOTE_VERT & nMyType ) diff --git a/sw/source/core/layout/colfrm.cxx b/sw/source/core/layout/colfrm.cxx index a583a1abeae6..bbd5366bb607 100644 --- a/sw/source/core/layout/colfrm.cxx +++ b/sw/source/core/layout/colfrm.cxx @@ -35,7 +35,7 @@ SwColumnFrame::SwColumnFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwFootnoteBossFrame( pFormat, pSib ) { - mnFrameType = FRM_COLUMN; + mnFrameType = SwFrameType::Column; SwBodyFrame* pColBody = new SwBodyFrame( pFormat->GetDoc()->GetDfltFrameFormat(), pSib ); pColBody->InsertBehind( this, nullptr ); // ColumnFrames now with BodyFrame SetMaxFootnoteHeight( LONG_MAX ); diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index 6036fa9cb232..7b5250103e43 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -51,7 +51,7 @@ * is null - no method calls are logged. * 2. The SwImplProtocol class contains a filter for frame types, only method * call of frame types which are defined there are logged. - * The member nTypes can be set to values like FRM_PAGE or FRM_SECTION and + * The member nTypes can be set to values like SwFrameType::Page or SwFrameType::Section and * may be combined using binary OR. The default values is 0xFFFF - meaning * all frame types. * 3. The SwImplProtocol class contains an ArrayPointer to FrameIds which need to be @@ -124,7 +124,7 @@ class SwImplProtocol std::set<sal_uInt16> *pFrameIds; // which FrameIds shall be logged ( NULL == all) std::vector<long> aVars; // variables OStringBuffer aLayer; // indentation of output (" " per start/end) - sal_uInt16 nTypes; // which types shall be logged + SwFrameType nTypes; // which types shall be logged sal_uInt16 nLineCount; // printed lines sal_uInt16 nMaxLines; // max lines to be printed sal_uInt8 nInitFile; // range (FrameId,FrameType,Record) during reading of the INI file @@ -255,7 +255,7 @@ void SwProtocol::Stop() } SwImplProtocol::SwImplProtocol() - : pStream( nullptr ), pFrameIds( nullptr ), nTypes( 0xffff ), + : pStream( nullptr ), pFrameIds( nullptr ), nTypes( FRM_ALL ), nLineCount( 0 ), nMaxLines( USHRT_MAX ), nTestMode( 0 ) { NewStream(); @@ -306,7 +306,7 @@ void SwImplProtocol::CheckLine( OString& rLine ) else if (aTmp == "[frmtype")// section types { nInitFile = 2; - nTypes = USHRT_MAX; // default: log all frame types + nTypes = FRM_ALL; // default: log all frame types } else if (aTmp == "[record")// section functions { @@ -352,7 +352,7 @@ void SwImplProtocol::CheckLine( OString& rLine ) case 1: InsertFrame( sal_uInt16( nVal ) ); // add FrameId break; case 2: { - sal_uInt16 nNew = (sal_uInt16)nVal; + SwFrameType nNew = static_cast<SwFrameType>(nVal); if( bNo ) nTypes &= ~nNew; // remove type else diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx index 603c3f4d6b2c..beaec42ac102 100644 --- a/sw/source/core/layout/fly.cxx +++ b/sw/source/core/layout/fly.cxx @@ -80,7 +80,7 @@ SwFlyFrame::SwFlyFrame( SwFlyFrameFormat *pFormat, SwFrame* pSib, SwFrame *pAnch m_bLockDeleteContent( false ), m_bValidContentPos( false ) { - mnFrameType = FRM_FLY; + mnFrameType = SwFrameType::Fly; m_bInvalid = m_bNotifyBack = true; m_bLocked = m_bMinHeight = @@ -587,7 +587,7 @@ SwFlyFrame *SwFlyFrame::FindChainNeighbour( SwFrameFormat &rChain, SwFrame *pAnc // FindFooterOrHeader is not appropriate here, as we may not have a // connection to the Anchor yet. pLay = pAnch->GetUpper(); - while ( pLay && !(pLay->GetType() & (FRM_HEADER|FRM_FOOTER)) ) + while ( pLay && !(pLay->GetType() & (SwFrameType::Header|SwFrameType::Footer)) ) pLay = pLay->GetUpper(); } diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index ddee9c7bac43..c88e49cf205f 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -1032,10 +1032,11 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) SWRECTFN( pClip ) const SwLayoutFrame *pUp = pClip->GetUpper(); const SwFrame *pCell = pUp->IsCellFrame() ? pUp : nullptr; - const sal_uInt16 nType = bMove ? FRM_ROOT | FRM_FLY | FRM_HEADER | - FRM_FOOTER | FRM_FTN - : FRM_BODY | FRM_FLY | FRM_HEADER | - FRM_FOOTER | FRM_CELL| FRM_FTN; + const SwFrameType nType = bMove + ? SwFrameType::Root | SwFrameType::Fly | SwFrameType::Header | + SwFrameType::Footer | SwFrameType::Ftn + : SwFrameType::Body | SwFrameType::Fly | SwFrameType::Header | + SwFrameType::Footer | SwFrameType::Cell| SwFrameType::Ftn; while ( !(pUp->GetType() & nType) || pUp->IsColBodyFrame() ) { @@ -1054,7 +1055,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } if ( pUp ) { - if ( pUp->GetType() & FRM_BODY ) + if ( pUp->GetType() & SwFrameType::Body ) { const SwPageFrame *pPg; if ( pUp->GetUpper() != (pPg = pFly->FindPageFrame()) ) @@ -1068,7 +1069,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } else { - if( ( pUp->GetType() & (FRM_FLY | FRM_FTN ) ) && + if( ( pUp->GetType() & (SwFrameType::Fly | SwFrameType::Ftn ) ) && !pUp->Frame().IsInside( pFly->Frame().Pos() ) ) { if( pUp->IsFlyFrame() ) @@ -1096,7 +1097,7 @@ bool CalcClipRect( const SdrObject *pSdrObj, SwRect &rRect, bool bMove ) } rRect = pUp->Prt(); rRect.Pos() += pUp->Frame().Pos(); - if ( pUp->GetType() & (FRM_HEADER | FRM_FOOTER) ) + if ( pUp->GetType() & (SwFrameType::Header | SwFrameType::Footer) ) { rRect.Left ( pUp->GetUpper()->Frame().Left() ); rRect.Width( pUp->GetUpper()->Frame().Width()); diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 25ef901bce30..1a76edebd8fe 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -548,7 +548,7 @@ SwLayNotify::~SwLayNotify() { const SwViewShell *pSh = pLay->getRootFrame()->GetCurrShell(); if( !( pSh && pSh->GetViewOptions()->getBrowseMode() ) || - !(pLay->GetType() & (FRM_BODY | FRM_PAGE)) ) + !(pLay->GetType() & (SwFrameType::Body | SwFrameType::Page)) ) //Thereby the subordinates are retouched clean. //Example problem: Take the Flys with the handles and downsize. //Not for body and page, otherwise it flickers when loading HTML. @@ -580,10 +580,10 @@ SwLayNotify::~SwLayNotify() pLay->InvalidateNextPos(); } if ( !IsLowersComplete() && - !(pLay->GetType()&(FRM_FLY|FRM_SECTION) && + !(pLay->GetType()&(SwFrameType::Fly|SwFrameType::Section) && pLay->Lower() && pLay->Lower()->IsColumnFrame()) && (bPos || bNotify) && - !(pLay->GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + !(pLay->GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) { // #i44016# - force unlock of position of lower objects. // #i43913# - no unlock of position of objects, @@ -1862,7 +1862,7 @@ SwBorderAttrs::SwBorderAttrs(const SwModify *pMod, const SwFrame *pConstructor) m_bCachedJoinedWithPrev = false; m_bCachedJoinedWithNext = false; - m_bBorderDist = 0 != (pConstructor->GetType() & (FRM_CELL)); + m_bBorderDist = bool(pConstructor->GetType() & SwFrameType::Cell); } SwBorderAttrs::~SwBorderAttrs() @@ -3127,11 +3127,11 @@ bool Is_Lower_Of(const SwFrame *pCurrFrame, const SdrObject* pObj) } /// provides the area of a frame in that no Fly from another area can overlap -const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalContextType ) +const SwFrame *FindKontext( const SwFrame *pFrame, SwFrameType nAdditionalContextType ) { - const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT | - FRM_FTN | FRM_FLY | - FRM_TAB | FRM_ROW | FRM_CELL | + const SwFrameType nTyp = SwFrameType::Root | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont | + SwFrameType::Ftn | SwFrameType::Fly | + SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell | nAdditionalContextType; do { if ( pFrame->GetType() & nTyp ) @@ -3143,11 +3143,11 @@ const SwFrame *FindKontext( const SwFrame *pFrame, sal_uInt16 nAdditionalContext bool IsFrameInSameKontext( const SwFrame *pInnerFrame, const SwFrame *pFrame ) { - const SwFrame *pKontext = FindKontext( pInnerFrame, 0 ); + const SwFrame *pKontext = FindKontext( pInnerFrame, SwFrameType::None ); - const sal_uInt16 nTyp = FRM_ROOT | FRM_HEADER | FRM_FOOTER | FRM_FTNCONT | - FRM_FTN | FRM_FLY | - FRM_TAB | FRM_ROW | FRM_CELL; + const SwFrameType nTyp = SwFrameType::Root | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont | + SwFrameType::Ftn | SwFrameType::Fly | + SwFrameType::Tab | SwFrameType::Row | SwFrameType::Cell; do { if ( pFrame->GetType() & nTyp ) { @@ -3271,7 +3271,7 @@ void SwFrameHolder::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } -SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, sal_uInt16 const nFrameType, +SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, SwFrameType const nFrameType, const Point* pPoint, const SwPosition *pPos, const bool bCalcFrame ) { SwFrame *pMinFrame = nullptr, *pTmpFrame; @@ -3327,7 +3327,7 @@ SwFrame* GetFrameOfModify( const SwRootFrame* pLayout, SwModify const& rMod, sal } // for Flys go via the parent if the Fly is not yet "formatted" - if( !bCalcFrame && pTmpFrame->GetType() & FRM_FLY && + if( !bCalcFrame && pTmpFrame->GetType() & SwFrameType::Fly && static_cast<SwFlyFrame*>(pTmpFrame)->GetAnchorFrame() && FAR_AWAY == pTmpFrame->Frame().Pos().getX() && FAR_AWAY == pTmpFrame->Frame().Pos().getY() ) diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index ca12b249004f..05b993bd6141 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -145,7 +145,7 @@ static sal_uInt16 lcl_ColumnNum( const SwFrame* pBoss ) SwFootnoteContFrame::SwFootnoteContFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwLayoutFrame( pFormat, pSib ) { - mnFrameType = FRM_FTNCONT; + mnFrameType = SwFrameType::FtnCont; } @@ -427,7 +427,7 @@ SwFootnoteFrame::SwFootnoteFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwConte // #i49383# mbUnlockPosOfLowerObjs( true ) { - mnFrameType = FRM_FTN; + mnFrameType = SwFrameType::Ftn; } void SwFootnoteFrame::InvalidateNxtFootnoteCnts( SwPageFrame *pPage ) diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx index 55ab3914de47..0caa0f3242d1 100644 --- a/sw/source/core/layout/hffrm.cxx +++ b/sw/source/core/layout/hffrm.cxx @@ -94,7 +94,7 @@ static void lcl_LayoutFrameEnsureMinHeight(SwLayoutFrame & rFrame, } } -SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, sal_uInt16 nTypeIn) +SwHeadFootFrame::SwHeadFootFrame( SwFrameFormat * pFormat, SwFrame* pSib, SwFrameType nTypeIn) : SwLayoutFrame( pFormat, pSib ) { mnFrameType = nTypeIn; diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx index 37984804ca18..ce1fccbf3239 100644 --- a/sw/source/core/layout/newfrm.cxx +++ b/sw/source/core/layout/newfrm.cxx @@ -457,7 +457,7 @@ SwRootFrame::SwRootFrame( SwFrameFormat *pFormat, SwViewShell * pSh ) : mnPhyPageNums( 0 ), mnAccessibleShells( 0 ) { - mnFrameType = FRM_ROOT; + mnFrameType = SwFrameType::Root; setRootFrame( this ); } diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 9f2c94c51eca..eedaf7c78453 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -63,7 +63,7 @@ using namespace ::com::sun::star; SwBodyFrame::SwBodyFrame( SwFrameFormat *pFormat, SwFrame* pSib ): SwLayoutFrame( pFormat, pSib ) { - mnFrameType = FRM_BODY; + mnFrameType = SwFrameType::Body; } void SwBodyFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs * ) @@ -172,7 +172,7 @@ SwPageFrame::SwPageFrame( SwFrameFormat *pFormat, SwFrame* pSib, SwPageDesc *pPg m_bHasGrid = false; SetMaxFootnoteHeight( pPgDsc->GetFootnoteInfo().GetHeight() ? pPgDsc->GetFootnoteInfo().GetHeight() : LONG_MAX ); - mnFrameType = FRM_PAGE; + mnFrameType = SwFrameType::Page; m_bInvalidLayout = m_bInvalidContent = m_bInvalidSpelling = m_bInvalidSmartTags = m_bInvalidAutoCmplWrds = m_bInvalidWordCount = true; m_bInvalidFlyLayout = m_bInvalidFlyContent = m_bInvalidFlyInCnt = m_bFootnotePage = m_bEndNotePage = false; @@ -350,7 +350,10 @@ static void lcl_FormatLay( SwLayoutFrame *pLay ) // first the low-level ones while ( pTmp ) { - if ( pTmp->GetType() & 0x00FF ) + const SwFrameType nTypes = SwFrameType::Root | SwFrameType::Page | SwFrameType::Column + | SwFrameType::Header | SwFrameType::Footer | SwFrameType::FtnCont + | SwFrameType::Ftn | SwFrameType::Body; + if ( pTmp->GetType() & nTypes ) ::lcl_FormatLay( static_cast<SwLayoutFrame*>(pTmp) ); pTmp = pTmp->GetNext(); } @@ -470,7 +473,7 @@ void SwPageFrame::PreparePage( bool bFootnote ) SwLayoutFrame *pLow = static_cast<SwLayoutFrame*>(Lower()); while ( pLow ) { - if ( pLow->GetType() & (FRM_HEADER|FRM_FOOTER) ) + if ( pLow->GetType() & (SwFrameType::Header|SwFrameType::Footer) ) { SwContentFrame *pContent = pLow->ContainsContent(); while ( pContent && pLow->IsAnLower( pContent ) ) diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx index fecbd0ac88aa..05d0de2fd882 100644 --- a/sw/source/core/layout/pagedesc.cxx +++ b/sw/source/core/layout/pagedesc.cxx @@ -234,7 +234,7 @@ void SwPageDesc::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew ) static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd ) { const SwModify* pMod; - sal_uInt16 nFrameType = FRM_CNTNT; + SwFrameType nFrameType = FRM_CNTNT; if( rNd.IsContentNode() ) { @@ -243,7 +243,7 @@ static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd ) else if( rNd.IsTableNode() ) { pMod = static_cast<const SwTableNode&>(rNd).GetTable().GetFrameFormat(); - nFrameType = FRM_TAB; + nFrameType = SwFrameType::Tab; } else pMod = nullptr; diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 03c0c6a904a1..36ab1611372b 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -5431,7 +5431,7 @@ void SwFrame::PaintBorder( const SwRect& rRect, const SwPageFrame *pPage, const SwBorderAttrs &rAttrs ) const { // There's nothing (Row,Body,Footnote,Root,Column,NoText) need to do here - if ((GetType() & (FRM_NOTXT|FRM_ROW|FRM_BODY|FRM_FTN|FRM_COLUMN|FRM_ROOT))) + if ((GetType() & (SwFrameType::NoTxt|SwFrameType::Row|SwFrameType::Body|SwFrameType::Ftn|SwFrameType::Column|SwFrameType::Root))) return; if (IsCellFrame() && !gProp.pSGlobalShell->GetViewOptions()->IsTable()) diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index e22c23d9676d..26f76bee4892 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -50,7 +50,7 @@ SwSectionFrame::SwSectionFrame( SwSection &rSect, SwFrame* pSib ) , m_bOwnFootnoteNum(false) , m_bFootnoteLock(false) { - mnFrameType = FRM_SECTION; + mnFrameType = SwFrameType::Section; CalcFootnoteAtEndFlag(); CalcEndAtEndFlag(); @@ -66,7 +66,7 @@ SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) : m_bOwnFootnoteNum( false ), m_bFootnoteLock( false ) { - mnFrameType = FRM_SECTION; + mnFrameType = SwFrameType::Section; PROTOCOL( this, PROT_SECTION, bMaster ? ACT_CREATE_MASTER : ACT_CREATE_FOLLOW, &rSect ) diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx index e185feac12f3..adf1feeda314 100644 --- a/sw/source/core/layout/tabfrm.cxx +++ b/sw/source/core/layout/tabfrm.cxx @@ -78,7 +78,7 @@ SwTabFrame::SwTabFrame( SwTable &rTab, SwFrame* pSib ) , m_bInRecalcLowerRow(false) { mbFixSize = false; //Don't fall for import filter again. - mnFrameType = FRM_TAB; + mnFrameType = SwFrameType::Tab; //Create the lines and insert them. const SwTableLines &rLines = rTab.GetTabLines(); @@ -116,7 +116,7 @@ SwTabFrame::SwTabFrame( SwTabFrame &rTab ) , m_bInRecalcLowerRow(false) { mbFixSize = false; //Don't fall for import filter again. - mnFrameType = FRM_TAB; + mnFrameType = SwFrameType::Tab; SetFollow( rTab.GetFollow() ); rTab.SetFollow( this ); @@ -3561,7 +3561,7 @@ SwRowFrame::SwRowFrame(const SwTableLine &rLine, SwFrame* pSib, bool bInsertCont , m_bIsRepeatedHeadline( false ) , m_bIsRowSpanLine( false ) { - mnFrameType = FRM_ROW; + mnFrameType = SwFrameType::Row; //Create the boxes and insert them. const SwTableBoxes &rBoxes = rLine.GetTabBoxes(); @@ -4444,7 +4444,7 @@ SwCellFrame::SwCellFrame(const SwTableBox &rBox, SwFrame* pSib, bool bInsertCont : SwLayoutFrame( rBox.GetFrameFormat(), pSib ) , m_pTabBox( &rBox ) { - mnFrameType = FRM_CELL; + mnFrameType = SwFrameType::Cell; if ( !bInsertContent ) return; diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index c8f4911924a5..c46247f41854 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -2065,7 +2065,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) // allowed (header/footer/table-headline) for two pages. do { // middle check loop const SwLayoutFrame* pSttLFrame = pStartFrame->GetUpper(); - const sal_uInt16 cHdFtTableHd = FRM_HEADER | FRM_FOOTER | FRM_TAB; + const SwFrameType cHdFtTableHd = SwFrameType::Header | SwFrameType::Footer | SwFrameType::Tab; while( pSttLFrame && ! (cHdFtTableHd & pSttLFrame->GetType() )) pSttLFrame = pSttLFrame->GetUpper(); @@ -2082,8 +2082,8 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) "Selection over different content" ); switch( pSttLFrame->GetType() ) { - case FRM_HEADER: - case FRM_FOOTER: + case SwFrameType::Header: + case SwFrameType::Footer: // On different pages? Then always on the start-page if( pEndLFrame->FindPageFrame() != pSttLFrame->FindPageFrame() ) { @@ -2094,7 +2094,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) pStartFrame = pEndFrame; } break; - case FRM_TAB: + case SwFrameType::Tab: // On different pages? Then check for table-headline { const SwTabFrame* pTabFrame = static_cast<const SwTabFrame*>(pSttLFrame); @@ -2113,6 +2113,7 @@ void SwRootFrame::CalcFrameRects(SwShellCursor &rCursor) } } break; + default: break; } } while( false ); diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 530d78d1f35d..599bef62d0a7 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -63,7 +63,7 @@ SwFrame::SwFrame( SwModify *pMod, SwFrame* pSib ) : mpNext(nullptr), mpPrev(nullptr), mpDrawObjs(nullptr), - mnFrameType(0), + mnFrameType(SwFrameType::None), mbInfBody( false ), mbInfTab ( false ), mbInfFly ( false ), @@ -1631,7 +1631,7 @@ void SwFrame::ReinitializeFrameSizeAttrFlags() ATT_MIN_SIZE == rFormatSize.GetHeightSizeType()) { mbFixSize = false; - if ( GetType() & (FRM_HEADER | FRM_FOOTER | FRM_ROW) ) + if ( GetType() & (SwFrameType::Header | SwFrameType::Footer | SwFrameType::Row) ) { SwFrame *pFrame = static_cast<SwLayoutFrame*>(this)->Lower(); while ( pFrame ) @@ -1718,7 +1718,9 @@ SwTwips SwContentFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if( !(GetUpper()->GetType() & nTmpType) && GetUpper()->HasFixSize() ) { if ( !bTst ) @@ -2200,7 +2202,9 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) { const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse with Body + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if( !(GetType() & nTmpType) && HasFixSize() ) return 0; @@ -2331,7 +2335,7 @@ SwTwips SwLayoutFrame::GrowFrame( SwTwips nDist, bool bTst, bool bInfo ) _InvalidateAll(); InvalidatePage( pPage ); } - if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + if (!(GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) NotifyLowerObjs(); if( IsCellFrame() ) @@ -2360,7 +2364,9 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) { const SwViewShell *pSh = getRootFrame()->GetCurrShell(); const bool bBrowse = pSh && pSh->GetViewOptions()->getBrowseMode(); - const sal_uInt16 nTmpType = bBrowse ? 0x2084: 0x2004; //Row+Cell, Browse by Body. + SwFrameType nTmpType = SwFrameType::Cell | SwFrameType::Column; + if (bBrowse) + nTmpType |= SwFrameType::Body; if (pSh && pSh->GetViewOptions()->IsWhitespaceHidden()) { @@ -2518,7 +2524,7 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) SetCompletePaint(); } - if (!(GetType() & (FRM_ROW|FRM_TAB|FRM_FTNCONT|FRM_PAGE|FRM_ROOT))) + if (!(GetType() & (SwFrameType::Row|SwFrameType::Tab|SwFrameType::FtnCont|SwFrameType::Page|SwFrameType::Root))) NotifyLowerObjs(); if( IsCellFrame() ) @@ -2716,15 +2722,15 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) // In vertical layout these are neighbour frames (cell and column frames), // header frames and footer frames. // In horizontal layout these are all frames, which aren't neighbour frames. - const sal_uInt16 nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT) - : ~FRM_NEIGHBOUR; + const SwFrameType nFixWidth = bVert ? (FRM_NEIGHBOUR | FRM_HEADFOOT) + : ~SwFrameType(FRM_NEIGHBOUR); // Declare const unsigned short <nFixHeight> and init it this frame types // which has fixed height in vertical respectively horizontal layout. // In vertical layout these are all frames, which aren't neighbour frames, // header frames, footer frames, body frames or foot note container frames. // In horizontal layout these are neighbour frames. - const sal_uInt16 nFixHeight= bVert ? ~(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC) + const SwFrameType nFixHeight = bVert ? ~SwFrameType(FRM_NEIGHBOUR | FRM_HEADFOOT | FRM_BODYFTNC) : FRM_NEIGHBOUR; // Travel through all lowers using <GetNext()> @@ -2742,8 +2748,8 @@ void SwLayoutFrame::ChgLowersProp( const Size& rOldSize ) { // If lower isn't a table, row, cell or section frame, adjust its // frame size. - const sal_uInt16 nLowerType = pLowerFrame->GetType(); - if ( !(nLowerType & (FRM_TAB|FRM_ROW|FRM_CELL|FRM_SECTION)) ) + const SwFrameType nLowerType = pLowerFrame->GetType(); + if ( !(nLowerType & (SwFrameType::Tab|SwFrameType::Row|SwFrameType::Cell|SwFrameType::Section)) ) { if ( bWidthChgd ) { diff --git a/sw/source/core/objectpositioning/anchoredobjectposition.cxx b/sw/source/core/objectpositioning/anchoredobjectposition.cxx index 3807f8fa5d83..e6903851d850 100644 --- a/sw/source/core/objectpositioning/anchoredobjectposition.cxx +++ b/sw/source/core/objectpositioning/anchoredobjectposition.cxx @@ -911,7 +911,7 @@ SwTwips SwAnchoredObjectPosition::_AdjustHoriRelPosForDrawAside( const sal_uInt32 nObjOrdNum = GetObject().GetOrdNum(); const SwPageFrame* pObjPage = rFlyAtContentFrame.FindPageFrame(); - const SwFrame* pObjContext = ::FindKontext( &rAnchorTextFrame, FRM_COLUMN ); + const SwFrame* pObjContext = ::FindKontext( &rAnchorTextFrame, SwFrameType::Column ); sal_uLong nObjIndex = rAnchorTextFrame.GetTextNode()->GetIndex(); SwOrderIter aIter( pObjPage ); const SwFlyFrame* pFly = static_cast<const SwVirtFlyDrawObj*>(aIter.Bottom())->GetFlyFrame(); @@ -1020,7 +1020,7 @@ bool SwAnchoredObjectPosition::_DrawAsideFly( const SwFlyFrame* _pFly, if ( _pFly->IsFlyAtContentFrame() && (_pFly->Frame().*fnRect->fnBottomDist)( (_rObjRect.*fnRect->fnGetTop)() ) < 0 && (_rObjRect.*fnRect->fnBottomDist)( (_pFly->Frame().*fnRect->fnGetTop)() ) < 0 && - ::FindKontext( _pFly->GetAnchorFrame(), FRM_COLUMN ) == _pObjContext ) + ::FindKontext( _pFly->GetAnchorFrame(), SwFrameType::Column ) == _pObjContext ) { sal_uLong nOtherIndex = static_cast<const SwTextFrame*>(_pFly->GetAnchorFrame())->GetTextNode()->GetIndex(); diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx index c20cb7572329..48f574b562e7 100644 --- a/sw/source/core/text/EnhancedPDFExportHelper.cxx +++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx @@ -985,7 +985,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * GROUPING ELEMENTS */ - case FRM_PAGE : + case SwFrameType::Page : // Document: Document @@ -993,15 +993,15 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aDocumentString; break; - case FRM_HEADER : - case FRM_FOOTER : + case SwFrameType::Header : + case SwFrameType::Footer : // Header, Footer: NonStructElement nPDFType = vcl::PDFWriter::NonStructElement; break; - case FRM_FTNCONT : + case SwFrameType::FtnCont : // Footnote container: Division @@ -1009,7 +1009,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aDivString; break; - case FRM_FTN : + case SwFrameType::Ftn : // Footnote frame: Note @@ -1019,7 +1019,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() aPDFType = aNoteString; break; - case FRM_SECTION : + case SwFrameType::Section : // Section: TOX, Index, or Sect @@ -1055,7 +1055,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * BLOCK-LEVEL STRUCTURE ELEMENTS */ - case FRM_TXT : + case SwFrameType::Txt : { const SwTextNode* pTextNd = static_cast<const SwTextFrame*>(pFrame)->GetTextNode(); @@ -1161,7 +1161,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } break; - case FRM_TAB : + case SwFrameType::Tab : // TabFrame: Table @@ -1213,7 +1213,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * TABLE ELEMENTS */ - case FRM_ROW : + case SwFrameType::Row : // RowFrame: TR @@ -1228,7 +1228,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } break; - case FRM_CELL : + case SwFrameType::Cell : // CellFrame: TH, TD @@ -1251,7 +1251,7 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() * ILLUSTRATION */ - case FRM_FLY : + case SwFrameType::Fly : // FlyFrame: Figure, Formula, Control // fly in content or fly at page @@ -1290,6 +1290,8 @@ void SwTaggedPDFHelper::BeginBlockStructureElements() } } break; + + default: break; } if ( USHRT_MAX != nPDFType ) diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 5c3f8a063058..a84f75798b9d 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -349,10 +349,10 @@ bool SwTextFrame::FillRegister( SwTwips& rRegStart, sal_uInt16& rRegDiff ) { const SwFrame *pFrame = this; rRegDiff = 0; - while( !( ( FRM_BODY | FRM_FLY ) + while( !( ( SwFrameType::Body | SwFrameType::Fly ) & pFrame->GetType() ) && pFrame->GetUpper() ) pFrame = pFrame->GetUpper(); - if( ( FRM_BODY| FRM_FLY ) & pFrame->GetType() ) + if( ( SwFrameType::Body| SwFrameType::Fly ) & pFrame->GetType() ) { SWRECTFN( pFrame ) rRegStart = (pFrame->*fnRect->fnGetPrtTop)(); diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx index 58d931aad567..91c6d8d4cba3 100644 --- a/sw/source/core/text/txtfly.cxx +++ b/sw/source/core/text/txtfly.cxx @@ -799,7 +799,7 @@ bool SwTextFly::GetTop( const SwAnchoredObject* _pAnchoredObj, const IDocumentSettingAccess* pIDSA = pCurrFrame->GetTextNode()->getIDocumentSettingAccess(); if ( ( pIDSA->get(DocumentSettingId::CONSIDER_WRAP_ON_OBJECT_POSITION) || !pIDSA->get(DocumentSettingId::USE_FORMER_TEXT_WRAPPING) ) && - ::FindKontext( pTmp, 0 ) == ::FindKontext( pCurrFrame, 0 ) ) + ::FindKontext( pTmp, SwFrameType::None ) == ::FindKontext( pCurrFrame, SwFrameType::None ) ) { return true; } diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index 14dab78600fd..49028e0c8802 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -372,7 +372,7 @@ SwTextFrame::SwTextFrame(SwTextNode * const pNode, SwFrame* pSib ) , mbIsSwapped( false ) , mbFollowFormatAllowed( true ) { - mnFrameType = FRM_TXT; + mnFrameType = SwFrameType::Txt; } void SwTextFrame::DestroyImpl() diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index ab5028ec2665..bfb5615f40e1 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -238,54 +238,52 @@ void SwFrame::dumpAsXml( xmlTextWriterPtr writer ) const switch ( GetType( ) ) { - case FRM_ROOT: + case SwFrameType::Root: name = "root"; break; - case FRM_PAGE: + case SwFrameType::Page: name = "page"; break; - case FRM_COLUMN: + case SwFrameType::Column: name = "column"; break; - case FRM_HEADER: + case SwFrameType::Header: name = "header"; break; - case FRM_FOOTER: + case SwFrameType::Footer: name = "footer"; break; - case FRM_FTNCONT: + case SwFrameType::FtnCont: name = "ftncont"; break; - case FRM_FTN: + case SwFrameType::Ftn: name = "ftn"; break; - case FRM_BODY: + case SwFrameType::Body: name = "body"; break; - case FRM_FLY: + case SwFrameType::Fly: name = "fly"; break; - case FRM_SECTION: + case SwFrameType::Section: name = "section"; break; - case FRM_UNUSED: - name = "unused"; - break; - case FRM_TAB: + case SwFrameType::Tab: name = "tab"; break; - case FRM_ROW: + case SwFrameType::Row: name = "row"; break; - case FRM_CELL: + case SwFrameType::Cell: name = "cell"; break; - case FRM_TXT: + case SwFrameType::Txt: name = "txt"; break; - case FRM_NOTXT: + case SwFrameType::NoTxt: name = "notxt"; break; + default: break; }; if ( name != nullptr ) |