diff options
author | Noel Grandin <noel@peralex.com> | 2015-01-09 10:04:38 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-01-09 10:06:17 +0200 |
commit | 901e5c3a21a1299d10c44bc844246fe8c329bb82 (patch) | |
tree | 358ff817974d0eb5c047aa28fe83a2c1871f756b | |
parent | cd9e2ecba38c31eb30e05d3ee2c9f4629dd89d40 (diff) |
fdo#84938: convert FRMTYPE_ #defines to 'enum class'
and consequently fix bug in SwPageFrm::PreparePage where it was
comparing against the wrong #define's
Change-Id: I681f7e9f3f9bbe1ddf2613814ed36cfe0955825f
27 files changed, 189 insertions, 183 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index 619013adcb62..49b591b9f289 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -31,6 +31,7 @@ #include <svx/svdtypes.hxx> #include <rtl/ustring.hxx> #include <svtools/embedhlp.hxx> +#include <o3tl/typed_flags_set.hxx> #include <vector> @@ -58,25 +59,31 @@ namespace svx } // return values for GetFrmType() und GetSelFrmType(). -//! values can be combined via logival or -#define FRMTYPE_NONE (sal_uInt16) 0 -#define FRMTYPE_PAGE (sal_uInt16) 1 -#define FRMTYPE_HEADER (sal_uInt16) 2 -#define FRMTYPE_FOOTER (sal_uInt16) 4 -#define FRMTYPE_BODY (sal_uInt16) 8 -#define FRMTYPE_COLUMN (sal_uInt16) 16 -#define FRMTYPE_TABLE (sal_uInt16) 32 -#define FRMTYPE_FLY_FREE (sal_uInt16) 64 -#define FRMTYPE_FLY_ATCNT (sal_uInt16) 128 -#define FRMTYPE_FLY_INCNT (sal_uInt16) 256 -#define FRMTYPE_FOOTNOTE (sal_uInt16) 512 -#define FRMTYPE_FTNPAGE (sal_uInt16) 1024 -#define FRMTYPE_FLY_ANY (sal_uInt16) 2048 -#define FRMTYPE_DRAWOBJ (sal_uInt16) 4096 -#define FRMTYPE_COLSECT (sal_uInt16) 8192 -#define FRMTYPE_COLSECTOUTTAB (sal_uInt16) 16384 - -//! values can be combined via logival or +//! values can be combined via logical or +enum class FrmTypeFlags { + NONE = 0, + PAGE = 1, + HEADER = 2, + FOOTER = 4, + BODY = 8, + COLUMN = 16, + TABLE = 32, + FLY_FREE = 64, + FLY_ATCNT = 128, + FLY_INCNT = 256, + FOOTNOTE = 512, + FTNPAGE = 1024, + FLY_ANY = 2048, + DRAWOBJ = 4096, + COLSECT = 8192, + COLSECTOUTTAB = 16384 +}; +namespace o3tl +{ + template<> struct typed_flags<FrmTypeFlags> : is_typed_flags<FrmTypeFlags, 0x4fff> {}; +} + +//! values can be combined via logical or #define GOTOOBJ_DRAW_CONTROL (sal_uInt16) 1 #define GOTOOBJ_DRAW_SIMPLE (sal_uInt16) 2 #define GOTOOBJ_DRAW_ANY (sal_uInt16) 3 @@ -86,7 +93,7 @@ namespace svx #define GOTOOBJ_FLY_ANY (sal_uInt16) 28 #define GOTOOBJ_GOTO_ANY (sal_uInt16) 31 -//! values can be combined via logival or +//! values can be combined via logical or #define FLYPROTECT_CONTENT (sal_uInt16) 1 #define FLYPROTECT_SIZE (sal_uInt16) 2 #define FLYPROTECT_POS (sal_uInt16) 4 @@ -276,8 +283,8 @@ public: pPt: Cursr or DocPos respectively; bStopAtFly: Stop at flys or continue over anchor. Although (0,TRUE) is kind of a standard, the parameters are not defaulted here in order to force more conscious use especially of bStopAtFly. */ - sal_uInt16 GetFrmType( const Point *pPt, bool bStopAtFly ) const; - sal_uInt16 GetSelFrmType() const; //Selektion (Drawing) + FrmTypeFlags GetFrmType( const Point *pPt, bool bStopAtFly ) const; + FrmTypeFlags GetSelFrmType() const; //Selektion (Drawing) /** check whether selected frame contains a control; * companion method to GetSelFrmType, used for preventing diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 9fc4cdcc9dae..6ae1625209a7 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -535,14 +535,14 @@ const SdrMarkList* SwFEShell::_GetMarkList() const return pMarkList; } -sal_uInt16 SwFEShell::GetSelFrmType() const +FrmTypeFlags SwFEShell::GetSelFrmType() const { - sal_uInt16 eType; + FrmTypeFlags eType; // get marked frame list, and check if anything is selected const SdrMarkList* pMarkList = _GetMarkList(); if( pMarkList == NULL || pMarkList->GetMarkCount() == 0 ) - eType = FRMTYPE_NONE; + eType = FrmTypeFlags::NONE; else { // obtain marked item as fly frame; if no fly frame, it must @@ -551,17 +551,17 @@ sal_uInt16 SwFEShell::GetSelFrmType() const if ( pFly != NULL ) { if( pFly->IsFlyLayFrm() ) - eType = FRMTYPE_FLY_FREE; + eType = FrmTypeFlags::FLY_FREE; else if( pFly->IsFlyAtCntFrm() ) - eType = FRMTYPE_FLY_ATCNT; + eType = FrmTypeFlags::FLY_ATCNT; else { OSL_ENSURE( pFly->IsFlyInCntFrm(), "New frametype?" ); - eType = FRMTYPE_FLY_INCNT; + eType = FrmTypeFlags::FLY_INCNT; } } else - eType = FRMTYPE_DRAWOBJ; + eType = FrmTypeFlags::DRAWOBJ; } return eType; diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx index 4fafe5203a77..fe86783dd7a0 100644 --- a/sw/source/core/frmedt/fews.cxx +++ b/sw/source/core/frmedt/fews.cxx @@ -208,9 +208,9 @@ bool SwFEShell::IsDirectlyInSection() const return pFrm && pFrm->GetUpper() && pFrm->GetUpper()->IsSctFrm(); } -sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const +FrmTypeFlags SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const { - sal_uInt16 nReturn = FRMTYPE_NONE; + FrmTypeFlags nReturn = FrmTypeFlags::NONE; const SwFrm *pFrm; if ( pPt ) { @@ -232,39 +232,39 @@ sal_uInt16 SwFEShell::GetFrmType( const Point *pPt, bool bStopAtFly ) const // from a section with footnotes at the end. if( pFrm->GetNext() || pFrm->GetPrev() ) // Sectioncolumns - nReturn |= ( nReturn & FRMTYPE_TABLE ) ? - FRMTYPE_COLSECTOUTTAB : FRMTYPE_COLSECT; + nReturn |= ( nReturn & FrmTypeFlags::TABLE ) ? + FrmTypeFlags::COLSECTOUTTAB : FrmTypeFlags::COLSECT; } else // only pages and frame columns - nReturn |= FRMTYPE_COLUMN; + nReturn |= FrmTypeFlags::COLUMN; break; - case FRM_PAGE: nReturn |= FRMTYPE_PAGE; + case FRM_PAGE: nReturn |= FrmTypeFlags::PAGE; if( static_cast<const SwPageFrm*>(pFrm)->IsFtnPage() ) - nReturn |= FRMTYPE_FTNPAGE; + nReturn |= FrmTypeFlags::FTNPAGE; break; - case FRM_HEADER: nReturn |= FRMTYPE_HEADER; break; - case FRM_FOOTER: nReturn |= FRMTYPE_FOOTER; break; + case FRM_HEADER: nReturn |= FrmTypeFlags::HEADER; break; + case FRM_FOOTER: nReturn |= FrmTypeFlags::FOOTER; break; case FRM_BODY: if( pFrm->GetUpper()->IsPageFrm() ) // not for ColumnFrms - nReturn |= FRMTYPE_BODY; + nReturn |= FrmTypeFlags::BODY; break; - case FRM_FTN: nReturn |= FRMTYPE_FOOTNOTE; break; + case FRM_FTN: nReturn |= FrmTypeFlags::FOOTNOTE; break; case FRM_FLY: if( static_cast<const SwFlyFrm*>(pFrm)->IsFlyLayFrm() ) - nReturn |= FRMTYPE_FLY_FREE; + nReturn |= FrmTypeFlags::FLY_FREE; else if ( static_cast<const SwFlyFrm*>(pFrm)->IsFlyAtCntFrm() ) - nReturn |= FRMTYPE_FLY_ATCNT; + nReturn |= FrmTypeFlags::FLY_ATCNT; else { OSL_ENSURE( static_cast<const SwFlyFrm*>(pFrm)->IsFlyInCntFrm(), "New frametype?" ); - nReturn |= FRMTYPE_FLY_INCNT; + nReturn |= FrmTypeFlags::FLY_INCNT; } - nReturn |= FRMTYPE_FLY_ANY; + nReturn |= FrmTypeFlags::FLY_ANY; if( bStopAtFly ) return nReturn; break; case FRM_TAB: case FRM_ROW: - case FRM_CELL: nReturn |= FRMTYPE_TABLE; break; + case FRM_CELL: nReturn |= FrmTypeFlags::TABLE; break; default: /* do nothing */ break; } if ( pFrm->IsFlyFrm() ) diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx index e03806bdd924..de0d1b22b81d 100644 --- a/sw/source/core/inc/frame.hxx +++ b/sw/source/core/inc/frame.hxx @@ -367,7 +367,6 @@ protected: bool mbCompletePaint : 1; bool mbRetouche : 1; // frame is responsible for retouching -protected: bool mbInfInvalid : 1; // InfoFlags are invalid bool mbInfBody : 1; // Frm is in document body bool mbInfTab : 1; // Frm is in a table @@ -511,7 +510,7 @@ public: drawinglayer::processor2d::BaseProcessor2D * CreateProcessor2D( ) const; void ProcessPrimitives( const drawinglayer::primitive2d::Primitive2DSequence& rSequence ) const; -// FIXME: EasyHack (refactoring): rename method name in all files + // FIXME: EasyHack (refactoring): rename method name in all files // retouch, not in the area of the given Rect! void Retouche( const SwPageFrm *pPage, const SwRect &rRect ) const; diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index cd1314bcb87e..427213eb0a4d 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -439,7 +439,7 @@ void SwPageFrm::PreparePage( bool bFtn ) // Thus, first calling <::RegistFlys(..)>, then call <::lcl_FormatLay(..)> ::RegistFlys( this, this ); - if ( Lower() ) + if ( Lower() ) { ::lcl_FormatLay( this ); } @@ -461,7 +461,7 @@ void SwPageFrm::PreparePage( bool bFtn ) SwLayoutFrm *pLow = static_cast<SwLayoutFrm*>(Lower()); while ( pLow ) { - if ( pLow->GetType() & (FRMTYPE_HEADER|FRMTYPE_FOOTER) ) + if ( pLow->GetType() & (FRM_HEADER|FRM_FOOTER) ) { SwCntntFrm *pCntnt = pLow->ContainsCntnt(); while ( pCntnt && pLow->IsAnLower( pCntnt ) ) diff --git a/sw/source/ui/chrdlg/break.cxx b/sw/source/ui/chrdlg/break.cxx index e0d9c542c71b..a7616885ad21 100644 --- a/sw/source/ui/chrdlg/break.cxx +++ b/sw/source/ui/chrdlg/break.cxx @@ -183,7 +183,7 @@ void SwBreakDlg::CheckEnable() bEnable = false; } else if(rSh.GetFrmType(0,true) - & (FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE)) + & (FrmTypeFlags::FLY_ANY | FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FOOTNOTE)) { m_pPageBtn->Enable(false); if(m_pPageBtn->IsChecked()) diff --git a/sw/source/ui/chrdlg/pardlg.cxx b/sw/source/ui/chrdlg/pardlg.cxx index 903ce472956f..f95e5113b81d 100644 --- a/sw/source/ui/chrdlg/pardlg.cxx +++ b/sw/source/ui/chrdlg/pardlg.cxx @@ -208,8 +208,8 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) else if( m_nParaExt == nId ) { // pagebreak only when the cursor is in the body-area and not in a table - const sal_uInt16 eType = rSh.GetFrmType(0,true); - if( !(FRMTYPE_BODY & eType) || + const FrmTypeFlags eType = rSh.GetFrmType(0,true); + if( !(FrmTypeFlags::BODY & eType) || rSh.GetSelectionType() & nsSelectionType::SEL_TBL ) { aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,true)); @@ -227,8 +227,8 @@ void SwParaDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) { // Seitenumbruch nur, wenn der Cursor im Body-Bereich und nicht in // einer Tabelle steht - const sal_uInt16 eType = rSh.GetFrmType(0,true); - if(!(FRMTYPE_BODY & eType) || + const FrmTypeFlags eType = rSh.GetFrmType(0,true); + if(!(FrmTypeFlags::BODY & eType) || rSh.GetSelectionType() & nsSelectionType::SEL_TBL) { aSet.Put(SfxBoolItem(SID_DISABLE_SVXEXTPARAGRAPHTABPAGE_PAGEBREAK,true)); diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index e25749690afc..dc7caf05b44e 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -691,7 +691,7 @@ IMPL_LINK( SwInsertDBColAutoPilot, TblFmtHdl, PushButton*, pButton ) } else nWidth = rSh.GetAnyCurRect( - FRMTYPE_FLY_ANY & rSh.GetFrmType( 0, true ) + FrmTypeFlags::FLY_ANY & rSh.GetFrmType( 0, true ) ? RECT_FLY_PRT_EMBEDDED : RECT_PAGE_PRT ).Width(); diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 6e76ef318c5f..f1b4407b58ac 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -267,12 +267,12 @@ void SwIndexMarkPane::InitControls() //to include all equal entries may only be allowed in the body and even there //only when a simple selection exists - const sal_uInt16 nFrmType = pSh->GetFrmType(0,true); + const FrmTypeFlags nFrmType = pSh->GetFrmType(0,true); m_pApplyToAllCB->Show(); m_pSearchCaseSensitiveCB->Show(); m_pSearchCaseWordOnlyCB->Show(); m_pApplyToAllCB->Enable(!aOrgStr.isEmpty() && - 0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY ))); + !(nFrmType & ( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FLY_ANY ))); SearchTypeHdl(m_pApplyToAllCB); } @@ -355,12 +355,12 @@ void SwIndexMarkPane::Activate() //to include all equal entries may only be allowed in the body and even there //only when a simple selection exists - const sal_uInt16 nFrmType = pSh->GetFrmType(0,true); + const FrmTypeFlags nFrmType = pSh->GetFrmType(0,true); m_pApplyToAllCB->Show(); m_pSearchCaseSensitiveCB->Show(); m_pSearchCaseWordOnlyCB->Show(); m_pApplyToAllCB->Enable(!aOrgStr.isEmpty() && - 0 == (nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FLY_ANY ))); + !(nFrmType & ( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FLY_ANY ))); SearchTypeHdl(m_pApplyToAllCB); } ModifyHdl(m_pTypeDCB); diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 2c11c22c8b47..c929c2136456 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1237,8 +1237,8 @@ void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage) else if (nId == m_nTextFlowId) { static_cast<SwTextFlowPage&>(rPage).SetShell(pShell); - const sal_uInt16 eType = pShell->GetFrmType(0,true); - if( !(FRMTYPE_BODY & eType) ) + const FrmTypeFlags eType = pShell->GetFrmType(0,true); + if( !(FrmTypeFlags::BODY & eType) ) static_cast<SwTextFlowPage&>(rPage).DisablePageBreak(); } } diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index dcd14a2341e7..1d5a1b507633 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -169,15 +169,15 @@ void SwDocShell::StateStyleSheet(SfxItemSet& rSet, SwWrtShell* pSh) nMask = SWSTYLEBIT_HTML; else { - const int nSelection = pShell->GetFrmType(0,true); + const FrmTypeFlags nSelection = pShell->GetFrmType(0,true); if(pShell->GetCurTOX()) nMask = SWSTYLEBIT_IDX ; - else if(nSelection & FRMTYPE_HEADER || - nSelection & FRMTYPE_FOOTER || - nSelection & FRMTYPE_TABLE || - nSelection & FRMTYPE_FLY_ANY || - nSelection & FRMTYPE_FOOTNOTE || - nSelection & FRMTYPE_FTNPAGE) + else if(nSelection & FrmTypeFlags::HEADER || + nSelection & FrmTypeFlags::FOOTER || + nSelection & FrmTypeFlags::TABLE || + nSelection & FrmTypeFlags::FLY_ANY || + nSelection & FrmTypeFlags::FOOTNOTE || + nSelection & FrmTypeFlags::FTNPAGE) nMask = SWSTYLEBIT_EXTRA; else nMask = SWSTYLEBIT_TEXT; diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 4c7afd931c1f..b7a4f44629cc 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -226,7 +226,7 @@ svx::SpellPortions SwSpellDialogChildWindow::GetNextWrongSentence(bool bRecheck) m_pSpellState->m_bStartedInSelection = true; } // determine if the selection is outside of the body text - bOtherText = !(pWrtShell->GetFrmType(0,true) & FRMTYPE_BODY); + bOtherText = !(pWrtShell->GetFrmType(0,true) & FrmTypeFlags::BODY); m_pSpellState->m_SpellStartPosition = bOtherText ? SPELL_START_OTHER : SPELL_START_BODY; if(bOtherText) { @@ -323,7 +323,7 @@ The code below would only be part of the solution. if (!m_pSpellState->m_bStartedInSelection) { // find out which text has been spelled body or other - bOtherText = !(pWrtShell->GetFrmType(0,true) & FRMTYPE_BODY); + bOtherText = !(pWrtShell->GetFrmType(0,true) & FrmTypeFlags::BODY); if(bOtherText && m_pSpellState->m_bStartedInOther && m_pSpellState->pOtherCursor) { m_pSpellState->m_bStartedInOther = false; diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index 92534d3e9fee..d23264e983c7 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -396,9 +396,9 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt ) //Drawing objects in Headers/Footers are not allowed SwWrtShell *pSrcSh = pMod->pDragDrop->GetShell(); - if( (pSrcSh->GetSelFrmType() == FRMTYPE_DRAWOBJ) && + if( (pSrcSh->GetSelFrmType() == FrmTypeFlags::DRAWOBJ) && pSrcSh->IsSelContainsControl() && - (rSh.GetFrmType( &aDocPt, false ) & (FRMTYPE_HEADER|FRMTYPE_FOOTER)) ) + (rSh.GetFrmType( &aDocPt, false ) & (FrmTypeFlags::HEADER|FrmTypeFlags::FOOTER)) ) { bCleanup = true; } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index f9ed3382493f..5e3033bea3e4 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1332,7 +1332,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) else if ( rKEvt.GetKeyCode().GetCode() == KEY_ESCAPE && rSh.IsHeaderFooterEdit( ) ) { - bool bHeader = FRMTYPE_HEADER & rSh.GetFrmType(0,false); + bool bHeader = bool(FrmTypeFlags::HEADER & rSh.GetFrmType(0,false)); if ( bHeader ) rSh.SttPg(); else @@ -3215,7 +3215,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) { // if the frame was deselected in the macro // the cursor just has to be displayed again - if( FRMTYPE_NONE == rSh.GetSelFrmType() ) + if( FrmTypeFlags::NONE == rSh.GetSelFrmType() ) rSh.ShowCrsr(); else { @@ -4421,7 +4421,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) { rSh.BreakDrag(); Point aEndPt, aSttPt; - if ( rSh.GetSelFrmType() & FRMTYPE_FLY_ATCNT ) + if ( rSh.GetSelFrmType() & FrmTypeFlags::FLY_ATCNT ) { aEndPt = aRect.TopLeft(); aSttPt = rSh.GetDrawView()->GetAllMarkedRect().TopLeft(); @@ -5630,7 +5630,7 @@ bool SwEditWin::SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos ) bRet = true; // in case the frame was deselected in the macro // just the cursor has to be displayed again. - if( FRMTYPE_NONE == rSh.GetSelFrmType() ) + if( FrmTypeFlags::NONE == rSh.GetSelFrmType() ) rSh.ShowCrsr(); else { diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 18e2562d7d24..7337c66d58fa 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -1253,7 +1253,7 @@ bool SwFldMgr::InsertFld( case TYP_FORMELFLD: { - if(pCurShell->GetFrmType(0,false) & FRMTYPE_TABLE) + if(pCurShell->GetFrmType(0,false) & FrmTypeFlags::TABLE) { pCurShell->StartAllAction(); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 7a5b68bd26df..c18d5f3aeb7f 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -1340,24 +1340,24 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) case FN_CONVERT_TABLE_TO_TEXT: { - sal_uInt16 eFrmType = rSh.GetFrmType(0,true); - if( (eFrmType & FRMTYPE_FOOTNOTE) || + FrmTypeFlags eFrmType = rSh.GetFrmType(0,true); + if( (eFrmType & FrmTypeFlags::FOOTNOTE) || !rSh.GetTableFmt() ) rSet.DisableItem( nWhich ); } break; case FN_CONVERT_TEXT_TO_TABLE: { - sal_uInt16 eFrmType = rSh.GetFrmType(0,true); - if( (eFrmType & FRMTYPE_FOOTNOTE) || + FrmTypeFlags eFrmType = rSh.GetFrmType(0,true); + if( (eFrmType & FrmTypeFlags::FOOTNOTE) || !rSh.IsTextToTableAvailable() ) rSet.DisableItem( nWhich ); } break; case FN_CONVERT_TEXT_TABLE: { - sal_uInt16 eFrmType = rSh.GetFrmType(0,true); - if( (eFrmType & FRMTYPE_FOOTNOTE) || + FrmTypeFlags eFrmType = rSh.GetFrmType(0,true); + if( (eFrmType & FrmTypeFlags::FOOTNOTE) || (!rSh.GetTableFmt() && !rSh.IsTextToTableAvailable() ) ) rSet.DisableItem( nWhich ); } @@ -2534,7 +2534,7 @@ void SwBaseShell::InsertTable( SfxRequest& _rRequest ) const SfxItemSet* pArgs = _rRequest.GetArgs(); SwWrtShell& rSh = GetShell(); - if ( !( rSh.GetFrmType( 0, true ) & FRMTYPE_FOOTNOTE ) ) + if ( !( rSh.GetFrmType( 0, true ) & FrmTypeFlags::FOOTNOTE ) ) { SwView &rTempView = GetView(); // Because GetView() does not work after the shell exchange bool bHTMLMode = 0 != (::GetHtmlMode(rTempView.GetDocShell())&HTMLMODE_ON); @@ -2724,13 +2724,13 @@ void SwBaseShell::GetGalleryState( SfxItemSet &rSet ) rLst.push_back( SW_RESSTR( STR_SWBG_OLE ) ); nOlePos = nPos++; } - const sal_uInt16 nType = rSh.GetFrmType(0,true); - if ( nType & FRMTYPE_HEADER ) + const FrmTypeFlags nType = rSh.GetFrmType(0,true); + if ( nType & FrmTypeFlags::HEADER ) { rLst.push_back( SW_RESSTR( STR_SWBG_HEADER ) ); nHeaderPos = nPos++; } - if ( nType & FRMTYPE_FOOTER ) + if ( nType & FrmTypeFlags::FOOTER ) { rLst.push_back( SW_RESSTR( STR_SWBG_FOOTER ) ); nFooterPos = nPos; diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 72c476595168..19c69e6790f6 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -712,7 +712,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) bProtect |= bParentCntProt; - const sal_uInt16 eFrmType = rSh.GetFrmType(0,true); + const FrmTypeFlags eFrmType = rSh.GetFrmType(0,true); SwFlyFrmAttrMgr aMgr( false, &rSh, FRMMGR_TYPE_NONE ); SfxWhichIter aIter( rSet ); @@ -747,7 +747,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_HORZ_CENTER: case FN_FRAME_ALIGN_HORZ_RIGHT: case FN_FRAME_ALIGN_HORZ_LEFT: - if ( (eFrmType & FRMTYPE_FLY_INCNT) || + if ( (eFrmType & FrmTypeFlags::FLY_INCNT) || bProtect || ((nWhich == FN_FRAME_ALIGN_HORZ_CENTER || nWhich == SID_OBJECT_ALIGN_CENTER) && bHtmlMode )) @@ -759,7 +759,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_CHAR_TOP: case FN_FRAME_ALIGN_VERT_CHAR_CENTER: case FN_FRAME_ALIGN_VERT_CHAR_BOTTOM: - if ( !(eFrmType & FRMTYPE_FLY_INCNT) || bProtect + if ( !(eFrmType & FrmTypeFlags::FLY_INCNT) || bProtect || (bHtmlMode && FN_FRAME_ALIGN_VERT_CHAR_BOTTOM == nWhich) ) rSet.DisableItem( nWhich ); break; @@ -771,12 +771,12 @@ void SwFrameShell::GetState(SfxItemSet& rSet) case FN_FRAME_ALIGN_VERT_TOP: case FN_FRAME_ALIGN_VERT_CENTER: case FN_FRAME_ALIGN_VERT_BOTTOM: - if ( bProtect || (bHtmlMode && eFrmType & FRMTYPE_FLY_ATCNT)) + if ( bProtect || (bHtmlMode && eFrmType & FrmTypeFlags::FLY_ATCNT)) rSet.DisableItem( nWhich ); else { sal_uInt16 nId = 0; - if (eFrmType & FRMTYPE_FLY_INCNT) + if (eFrmType & FrmTypeFlags::FLY_INCNT) { switch (nWhich) { diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 4c3db828888b..9a6bfa64ede1 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -1474,9 +1474,9 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case FN_INSERT_FOOTNOTE: case FN_INSERT_FOOTNOTE_DLG: { - const sal_uInt16 nNoType = - FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE; - if ( (rSh.GetFrmType(0,true) & nNoType) ) + const FrmTypeFlags nNoType = + FrmTypeFlags::FLY_ANY | FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FOOTNOTE; + if ( rSh.GetFrmType(0,true) & nNoType ) rSet.DisableItem(nWhich); if ( rSh.CrsrInsideInputFld() ) @@ -1499,7 +1499,7 @@ void SwTextShell::GetState( SfxItemSet &rSet ) case FN_INSERT_TABLE: if ( rSh.CrsrInsideInputFld() || rSh.GetTableFmt() - || (rSh.GetFrmType(0,true) & FRMTYPE_FOOTNOTE) ) + || (rSh.GetFrmType(0,true) & FrmTypeFlags::FOOTNOTE) ) { rSet.DisableItem( nWhich ); } diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx index d33e34adaaf3..fa98cf0f1ec4 100644 --- a/sw/source/uibase/shells/txtcrsr.cxx +++ b/sw/source/uibase/shells/txtcrsr.cxx @@ -362,7 +362,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) break; case FN_TO_HEADER: rSh.MoveCrsr(); - if ( FRMTYPE_HEADER & rSh.GetFrmType(0,false) ) + if ( FrmTypeFlags::HEADER & rSh.GetFrmType(0,false) ) rSh.SttPg(); else { @@ -374,7 +374,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) break; case FN_TO_FOOTER: rSh.MoveCrsr(); - if ( FRMTYPE_FOOTER & rSh.GetFrmType(0,false) ) + if ( FrmTypeFlags::FOOTER & rSh.GetFrmType(0,false) ) rSh.EndPg(); else { @@ -386,7 +386,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq) break; case FN_FOOTNOTE_TO_ANCHOR: rSh.MoveCrsr(); - if ( FRMTYPE_FOOTNOTE & rSh.GetFrmType(0,false) ) + if ( FrmTypeFlags::FOOTNOTE & rSh.GetFrmType(0,false) ) rSh.GotoFtnAnchor(); else rSh.GotoFtnTxt(); diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index d9c8990d9c0f..9838bc9f3c48 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -1103,7 +1103,7 @@ void SwView::WriteUserData( OUString &rUserData, bool bBrowse ) rUserData += OUString::number( (sal_uInt16)m_pWrtShell->GetViewOptions()->GetZoomType());//eZoom; rUserData += ";"; - rUserData += FRMTYPE_NONE == m_pWrtShell->GetSelFrmType() ? OUString("0") : OUString("1"); + rUserData += FrmTypeFlags::NONE == m_pWrtShell->GetSelFrmType() ? OUString("0") : OUString("1"); } // Set CursorPos @@ -1261,7 +1261,7 @@ void SwView::ReadUserDataSequence ( const uno::Sequence < beans::PropertyValue > bool bViewLayoutBookMode = pVOpt->IsViewLayoutBookMode(); sal_Int16 nViewLayoutColumns = pVOpt->GetViewLayoutColumns(); - bool bSelectedFrame = ( m_pWrtShell->GetSelFrmType() != FRMTYPE_NONE ), + bool bSelectedFrame = ( m_pWrtShell->GetSelFrmType() != FrmTypeFlags::NONE ), bGotVisibleLeft = false, bGotVisibleTop = false, bGotVisibleRight = false, bGotVisibleBottom = false, bGotZoomType = false, @@ -1516,7 +1516,7 @@ void SwView::WriteUserDataSequence ( uno::Sequence < beans::PropertyValue >& rSe pValue++;nIndex++; pValue->Name = "IsSelectedFrame"; - pValue->Value <<= FRMTYPE_NONE != m_pWrtShell->GetSelFrmType(); + pValue->Value <<= FrmTypeFlags::NONE != m_pWrtShell->GetSelFrmType(); nIndex++; assert(nIndex == NUM_VIEW_SETTINGS); diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 17cb15b06cbc..9003e424d298 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -246,7 +246,7 @@ void SwView::StartTextConversion( m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext(); const bool bStart = bSelection || m_pWrtShell->IsStartOfDoc(); - const bool bOther = !bSelection && !(m_pWrtShell->GetFrmType(0,true) & FRMTYPE_BODY); + const bool bOther = !bSelection && !(m_pWrtShell->GetFrmType(0,true) & FrmTypeFlags::BODY); { const uno::Reference< uno::XComponentContext > xContext( @@ -455,7 +455,7 @@ void SwView::HyphenateDocument() bool bOther = m_pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection; bool bStart = bSelection || ( !bOther && m_pWrtShell->IsStartOfDoc() ); bool bStop = false; - if( !bOther && !(m_pWrtShell->GetFrmType(0,true) & FRMTYPE_BODY) && !bSelection ) + if( !bOther && !(m_pWrtShell->GetFrmType(0,true) & FrmTypeFlags::BODY) && !bSelection ) // turned on no special area { // I want also in special areas hyphenation diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 4280ad80b6ce..868072865ad3 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -623,8 +623,8 @@ long SwView::PageUpCrsr( bool bSelect ) { if ( !bSelect ) { - const sal_uInt16 eType = m_pWrtShell->GetFrmType(0,true); - if ( eType & FRMTYPE_FOOTNOTE ) + const FrmTypeFlags eType = m_pWrtShell->GetFrmType(0,true); + if ( eType & FrmTypeFlags::FOOTNOTE ) { m_pWrtShell->MoveCrsr(); m_pWrtShell->GotoFtnAnchor(); diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 161892a276aa..875b7b473858 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -68,7 +68,7 @@ void SwView::GetState(SfxItemSet &rSet) { SfxWhichIter aIter(rSet); sal_uInt16 nWhich = aIter.FirstWhich(); - sal_uInt16 eFrmType = FRMTYPE_NONE; + FrmTypeFlags eFrmType = FrmTypeFlags::NONE; bool bGetFrmType = false; bool bWeb = 0 != PTR_CAST(SwWebView, this); @@ -101,7 +101,7 @@ void SwView::GetState(SfxItemSet &rSet) eFrmType = m_pWrtShell->GetFrmType(0, true); bGetFrmType = true; } - if (! ( ((eFrmType & FRMTYPE_FLY_ANY) && m_nSelectionType != nsSelectionType::SEL_DRW_TXT)|| + if (! ( ((eFrmType & FrmTypeFlags::FLY_ANY) && m_nSelectionType != nsSelectionType::SEL_DRW_TXT)|| m_nSelectionType & nsSelectionType::SEL_TBL || m_nSelectionType & nsSelectionType::SEL_DRW) ) { @@ -130,9 +130,9 @@ void SwView::GetState(SfxItemSet &rSet) case FN_CHANGE_PAGENUM: { - sal_uInt16 nType = m_pWrtShell->GetFrmType(0,true); - if( ( FRMTYPE_FLY_ANY | FRMTYPE_HEADER | FRMTYPE_FOOTER | - FRMTYPE_FOOTNOTE | FRMTYPE_DRAWOBJ ) & nType ) + FrmTypeFlags nType = m_pWrtShell->GetFrmType(0,true); + if( ( FrmTypeFlags::FLY_ANY | FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | + FrmTypeFlags::FOOTNOTE | FrmTypeFlags::DRAWOBJ ) & nType ) rSet.DisableItem(nWhich); else rSet.Put(SfxUInt16Item(nWhich, m_pWrtShell->GetPageOffset())); diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index e8d99b1d6c7f..0d75a1a149eb 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -223,8 +223,8 @@ void ResizeFrameCols(SwFmtCol& rCol, void SwView::ExecTabWin( SfxRequest& rReq ) { SwWrtShell &rSh = GetWrtShell(); - const sal_uInt16 nFrmType = rSh.IsObjSelected() ? - FRMTYPE_DRAWOBJ : + const FrmTypeFlags nFrmType = rSh.IsObjSelected() ? + FrmTypeFlags::DRAWOBJ : rSh.GetFrmType(0,true); const bool bFrmSelection = rSh.IsFrmSelected(); const bool bBrowse = rSh.GetViewOptions()->getBrowseMode(); @@ -249,7 +249,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) bool bUnlockView = false; rSh.StartAllAction(); - bool bSect = 0 != (nFrmType & FRMTYPE_COLSECT); + bool bSect = bool(nFrmType & FrmTypeFlags::COLSECT); switch (nSlot) { @@ -259,7 +259,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxLongLRSpaceItem aLongLR( static_cast<const SvxLongLRSpaceItem&>(pReqArgs-> Get( SID_ATTR_LONG_LRSPACE )) ); SvxLRSpaceItem aLR(RES_LR_SPACE); - if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) + if ( !bSect && (bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY) ) { SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt()); const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); @@ -309,7 +309,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) aSize.SetWidth( nPageWidth - (aLongLR.GetLeft() + aLongLR.GetRight())); - if( nFrmType & FRMTYPE_COLUMN ) + if( nFrmType & FrmTypeFlags::COLUMN ) { SwFmtCol aCol(pFmt->GetCol()); @@ -331,7 +331,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) rSh.Pop(); rSh.EndAction(); } - else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) + else if ( nFrmType & ( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER )) { // Subtract out page margins long nOld = rDesc.GetMaster().GetLRSpace().GetLeft(); @@ -342,12 +342,12 @@ void SwView::ExecTabWin( SfxRequest& rReq ) aLR.SetLeft(aLongLR.GetLeft()); aLR.SetRight(aLongLR.GetRight()); - if ( nFrmType & FRMTYPE_HEADER && pHeaderFmt ) + if ( nFrmType & FrmTypeFlags::HEADER && pHeaderFmt ) pHeaderFmt->SetFmtAttr( aLR ); - else if( nFrmType & FRMTYPE_FOOTER && pFooterFmt ) + else if( nFrmType & FrmTypeFlags::FOOTER && pFooterFmt ) pFooterFmt->SetFmtAttr( aLR ); } - else if( nFrmType == FRMTYPE_DRAWOBJ) + else if( nFrmType == FrmTypeFlags::DRAWOBJ) { SwRect aRect( rSh.GetObjRect() ); aRect.Left( aLongLR.GetLeft() + rPageRect.Left() ); @@ -418,7 +418,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxLongULSpaceItem aLongULSpace( static_cast<const SvxLongULSpaceItem&>(pReqArgs-> Get( SID_ATTR_LONG_ULSPACE ))); - if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + if( bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY ) { SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt()); const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); @@ -460,7 +460,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) aSet.Put( aSize ); rSh.SetFlyFrmAttr( aSet ); } - else if( nFrmType == FRMTYPE_DRAWOBJ ) + else if( nFrmType == FrmTypeFlags::DRAWOBJ ) { SwRect aRect( rSh.GetObjRect() ); aRect.Top( aLongULSpace.GetUpper() + rPageRect.Top() ); @@ -498,10 +498,10 @@ void SwView::ExecTabWin( SfxRequest& rReq ) else { SwPageDesc aDesc( rDesc ); - if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) + if ( nFrmType & ( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER )) { - const bool bHead = nFrmType & FRMTYPE_HEADER; + const bool bHead = bool(nFrmType & FrmTypeFlags::HEADER); SvxULSpaceItem aUL( rDesc.GetMaster().GetULSpace() ); if ( bHead ) aUL.SetUpper( (sal_uInt16)aLongULSpace.GetUpper() ); @@ -856,7 +856,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) } else { - if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY || bSect) + if ( bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY || bSect) { SwSectionFmt *pSectFmt = 0; SfxItemSet aSet( GetPool(), RES_COL, RES_COL ); @@ -996,8 +996,8 @@ void SwView::StateTabWin(SfxItemSet& rSet) SwWrtShell &rSh = GetWrtShell(); const Point* pPt = IsTabColFromDoc() || IsTabRowFromDoc() ? &m_aTabColFromDocPos : 0; - const sal_uInt16 nFrmType = rSh.IsObjSelected() - ? FRMTYPE_DRAWOBJ + const FrmTypeFlags nFrmType = rSh.IsObjSelected() + ? FrmTypeFlags::DRAWOBJ : rSh.GetFrmType( pPt, true ); const bool bFrmSelection = rSh.IsFrmSelected(); @@ -1092,10 +1092,10 @@ void SwView::StateTabWin(SfxItemSet& rSet) aLongLR.SetLeft(rPagePrtRect.Left()); aLongLR.SetRight(nPageWidth - rPagePrtRect.Right()); } - if ( ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) && - !(nFrmType & FRMTYPE_COLSECT) ) + if ( ( nFrmType & FrmTypeFlags::HEADER || nFrmType & FrmTypeFlags::FOOTER ) && + !(nFrmType & FrmTypeFlags::COLSECT) ) { - SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FRMTYPE_HEADER ? + SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FrmTypeFlags::HEADER ? rDesc.GetMaster().GetHeader().GetHeaderFmt() : rDesc.GetMaster().GetFooter().GetFooterFmt()); if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash @@ -1111,16 +1111,16 @@ void SwView::StateTabWin(SfxItemSet& rSet) else { SwRect aRect; - if( !bFrmSelection && ((nFrmType & FRMTYPE_COLSECT) || rSh.IsDirectlyInSection()) ) + if( !bFrmSelection && ((nFrmType & FrmTypeFlags::COLSECT) || rSh.IsDirectlyInSection()) ) { aRect = rSh.GetAnyCurRect(RECT_SECTION_PRT, pPt); const SwRect aTmpRect = rSh.GetAnyCurRect(RECT_SECTION, pPt); aRect.Pos() += aTmpRect.Pos(); } - else if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + else if ( bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY ) aRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); - else if( nFrmType & FRMTYPE_DRAWOBJ) + else if( nFrmType & FrmTypeFlags::DRAWOBJ) aRect = rSh.GetObjRect(); if( aRect.Width() ) @@ -1163,21 +1163,21 @@ void SwView::StateTabWin(SfxItemSet& rSet) (long)aUL.GetLower(), SID_ATTR_LONG_ULSPACE); - if ( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + if ( bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY ) { // Convert document coordinates into page coordinates. const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED, pPt); aLongUL.SetUpper(rRect.Top() - rPageRect.Top()); aLongUL.SetLower(rPageRect.Bottom() - rRect.Bottom()); } - else if ( nFrmType & FRMTYPE_HEADER || nFrmType & FRMTYPE_FOOTER ) + else if ( nFrmType & FrmTypeFlags::HEADER || nFrmType & FrmTypeFlags::FOOTER ) { SwRect aRect( rSh.GetAnyCurRect( RECT_HEADERFOOTER, pPt)); aRect.Pos() -= rSh.GetAnyCurRect( RECT_PAGE, pPt ).Pos(); aLongUL.SetUpper( aRect.Top() ); aLongUL.SetLower( nPageHeight - aRect.Bottom() ); } - else if( nFrmType & FRMTYPE_DRAWOBJ) + else if( nFrmType & FrmTypeFlags::DRAWOBJ) { const SwRect &rRect = rSh.GetObjRect(); aLongUL.SetUpper((rRect.Top() - rPageRect.Top())); @@ -1251,7 +1251,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || - nFrmType == FRMTYPE_DRAWOBJ || + nFrmType == FrmTypeFlags::DRAWOBJ || (!bVerticalWriting && (SID_ATTR_PARA_LRSPACE_VERTICAL == nWhich)) || ( bVerticalWriting && (SID_ATTR_PARA_LRSPACE == nWhich)) ) @@ -1319,12 +1319,12 @@ void SwView::StateTabWin(SfxItemSet& rSet) if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || - nFrmType == FRMTYPE_DRAWOBJ ) + nFrmType == FrmTypeFlags::DRAWOBJ ) rSet.DisableItem(SID_RULER_BORDER_DISTANCE); else { SvxLRSpaceItem aDistLR(SID_RULER_BORDER_DISTANCE); - if(nFrmType & FRMTYPE_FLY_ANY) + if(nFrmType & FrmTypeFlags::FLY_ANY) { if( IsTabColFromDoc() ) { @@ -1359,7 +1359,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } else if ( IsTabColFromDoc() || ( rSh.GetTableFmt() && !bFrmSelection && - !(nFrmType & FRMTYPE_COLSECT ) ) ) + !(nFrmType & FrmTypeFlags::COLSECT ) ) ) { SfxItemSet aCoreSet2( GetPool(), RES_BOX, RES_BOX, @@ -1392,7 +1392,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) aDistLR.SetRight(rBox.GetDistance(BOX_LINE_RIGHT)); const SvxBoxItem* pBox = 0; - if(nFrmType & FRMTYPE_HEADER) + if(nFrmType & FrmTypeFlags::HEADER) { rMaster.GetHeader(); const SwFmtHeader& rHeaderFmt = rMaster.GetHeader(); @@ -1400,7 +1400,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox(); } - else if(nFrmType & FRMTYPE_FOOTER ) + else if(nFrmType & FrmTypeFlags::FOOTER ) { const SwFmtFooter& rFooterFmt = rMaster.GetFooter(); SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt(); @@ -1434,7 +1434,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) if ( nSelType & nsSelectionType::SEL_GRF || nSelType & nsSelectionType::SEL_FRM || nSelType & nsSelectionType::SEL_OLE || - nFrmType == FRMTYPE_DRAWOBJ) + nFrmType == FrmTypeFlags::DRAWOBJ) rSet.DisableItem(nWhich); else { @@ -1456,7 +1456,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } bool bHasTable = ( IsTabColFromDoc() || ( rSh.GetTableFmt() && !bFrmSelection && - !(nFrmType & FRMTYPE_COLSECT ) ) ); + !(nFrmType & FrmTypeFlags::COLSECT ) ) ); bool bTableVertical = bHasTable && rSh.IsTableVertical(); @@ -1538,7 +1538,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } rSet.Put(aColItem, nWhich); } - else if ( bFrmSelection || nFrmType & ( FRMTYPE_COLUMN | FRMTYPE_COLSECT ) ) + else if ( bFrmSelection || nFrmType & ( FrmTypeFlags::COLUMN | FrmTypeFlags::COLSECT ) ) { // Out of frame or page? sal_uInt16 nNum = 0; @@ -1552,10 +1552,10 @@ void SwView::StateTabWin(SfxItemSet& rSet) nNum = rSh.GetCurColNum(); if( - // For that matter FRMTYPE_COLSECT should not be included + // For that matter FrmTypeFlags::COLSECT should not be included // if the border is selected! !bFrmSelection && - nFrmType & FRMTYPE_COLSECT ) + nFrmType & FrmTypeFlags::COLSECT ) { const SwSection *pSect = rSh.GetAnySection(false, pPt); OSL_ENSURE( pSect, "Which section?"); @@ -1593,7 +1593,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.Put(aColItem, nWhich); } } - else if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) + else if( bFrmSelection || nFrmType & FrmTypeFlags::FLY_ANY ) { // Columns in frame if ( nNum ) @@ -1709,7 +1709,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) rSet.DisableItem(nWhich); else if ( IsTabRowFromDoc() || ( rSh.GetTableFmt() && !bFrmSelection && - !(nFrmType & FRMTYPE_COLSECT ) ) ) + !(nFrmType & FrmTypeFlags::COLSECT ) ) ) { SwTabCols aTabCols; if ( ( m_bSetTabRowFromDoc = IsTabRowFromDoc() ) ) @@ -1790,10 +1790,10 @@ void SwView::StateTabWin(SfxItemSet& rSet) case SID_RULER_LR_MIN_MAX: { Rectangle aRectangle; - if( ( nFrmType & FRMTYPE_COLSECT ) && !IsTabColFromDoc() && - ( nFrmType & ( FRMTYPE_TABLE|FRMTYPE_COLUMN ) ) ) + if( ( nFrmType & FrmTypeFlags::COLSECT ) && !IsTabColFromDoc() && + ( nFrmType & ( FrmTypeFlags::TABLE|FrmTypeFlags::COLUMN ) ) ) { - if( nFrmType & FRMTYPE_TABLE ) + if( nFrmType & FrmTypeFlags::TABLE ) { const size_t nNum = rSh.GetCurTabColNum(); SwTabCols aTabCols; @@ -1879,18 +1879,18 @@ void SwView::StateTabWin(SfxItemSet& rSet) } } - else if ( ((nFrmType & FRMTYPE_TABLE) || IsTabColFromDoc()) && + else if ( ((nFrmType & FrmTypeFlags::TABLE) || IsTabColFromDoc()) && !bFrmSelection ) { bool bColumn; if ( IsTabColFromDoc() ) bColumn = rSh.GetCurMouseColNum( m_aTabColFromDocPos ) != 0; else - bColumn = (nFrmType & (FRMTYPE_COLUMN|FRMTYPE_FLY_ANY|FRMTYPE_COLSECTOUTTAB)) != 0; + bColumn = bool(nFrmType & (FrmTypeFlags::COLUMN|FrmTypeFlags::FLY_ANY|FrmTypeFlags::COLSECTOUTTAB)); if ( !bColumn ) { - if( nFrmType & FRMTYPE_FLY_ANY && IsTabColFromDoc() ) + if( nFrmType & FrmTypeFlags::FLY_ANY && IsTabColFromDoc() ) { SwRect aRect( rSh.GetAnyCurRect( RECT_FLY_PRT_EMBEDDED, pPt ) ); @@ -1913,11 +1913,11 @@ void SwView::StateTabWin(SfxItemSet& rSet) } else { // Here only for table in multi-column pages and borders. - bool bSectOutTbl = (nFrmType & FRMTYPE_TABLE) != 0; - bool bFrame = (nFrmType & FRMTYPE_FLY_ANY); - bool bColSct = (nFrmType & ( bSectOutTbl - ? FRMTYPE_COLSECTOUTTAB - : FRMTYPE_COLSECT ) + bool bSectOutTbl = bool(nFrmType & FrmTypeFlags::TABLE); + bool bFrame = bool(nFrmType & FrmTypeFlags::FLY_ANY); + bool bColSct = bool(nFrmType & ( bSectOutTbl + ? FrmTypeFlags::COLSECTOUTTAB + : FrmTypeFlags::COLSECT ) ); //So you can also drag with the mouse, without being in the table. CurRectType eRecType = RECT_PAGE_PRT; @@ -1995,7 +1995,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) } } } - else if ( nFrmType & ( FRMTYPE_HEADER | FRMTYPE_FOOTER )) + else if ( nFrmType & ( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER )) { aRectangle.Left() = aPageLRSpace.GetLeft(); aRectangle.Right() = aPageLRSpace.GetRight(); @@ -2023,7 +2023,7 @@ void SwView::StateTabWin(SfxItemSet& rSet) else { SvxProtectItem aProtect(SID_RULER_PROTECT); - if(bBrowse && !(nFrmType & (FRMTYPE_DRAWOBJ|FRMTYPE_COLUMN)) && !rSh.GetTableFmt()) + if(bBrowse && !(nFrmType & (FrmTypeFlags::DRAWOBJ|FrmTypeFlags::COLUMN)) && !rSh.GetTableFmt()) { aProtect.SetSizeProtect(true); aProtect.SetPosProtect(true); diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx index 91bbfadc6b67..f3696f67a71c 100644 --- a/sw/source/uibase/uno/unotxvw.cxx +++ b/sw/source/uibase/uno/unotxvw.cxx @@ -1087,18 +1087,18 @@ void SwXTextViewCursor::gotoRange( SwXParagraph::getUnoTunnelId())); } - const sal_uInt16 nFrmType = rSh.GetFrmType(0,true); + const FrmTypeFlags nFrmType = rSh.GetFrmType(0,true); SwStartNodeType eSearchNodeType = SwNormalStartNode; - if(nFrmType & FRMTYPE_FLY_ANY) + if(nFrmType & FrmTypeFlags::FLY_ANY) eSearchNodeType = SwFlyStartNode; - else if(nFrmType &FRMTYPE_HEADER) + else if(nFrmType &FrmTypeFlags::HEADER) eSearchNodeType = SwHeaderStartNode; - else if(nFrmType & FRMTYPE_FOOTER) + else if(nFrmType & FrmTypeFlags::FOOTER) eSearchNodeType = SwFooterStartNode; - else if(nFrmType & FRMTYPE_TABLE) + else if(nFrmType & FrmTypeFlags::TABLE) eSearchNodeType = SwTableBoxStartNode; - else if(nFrmType & FRMTYPE_FOOTNOTE) + else if(nFrmType & FrmTypeFlags::FOOTNOTE) eSearchNodeType = SwFootnoteStartNode; const SwStartNode* pOwnStartNode = aOwnPaM.GetNode(). diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx index dbd63cb8f6d3..bf04b618250c 100644 --- a/sw/source/uibase/utlui/navipi.cxx +++ b/sw/source/uibase/utlui/navipi.cxx @@ -244,8 +244,8 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) case FN_SELECT_FOOTER: { rSh.MoveCrsr(); - const sal_uInt16 eType = rSh.GetFrmType(0,false); - if (eType & FRMTYPE_FOOTER) + const FrmTypeFlags eType = rSh.GetFrmType(0,false); + if (eType & FrmTypeFlags::FOOTER) { if (rSh.EndPg()) nFuncId = FN_END_OF_PAGE; @@ -258,8 +258,8 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) case FN_SELECT_HEADER: { rSh.MoveCrsr(); - const sal_uInt16 eType = rSh.GetFrmType(0,false); - if (eType & FRMTYPE_HEADER) + const FrmTypeFlags eType = rSh.GetFrmType(0,false); + if (eType & FrmTypeFlags::HEADER) { if (rSh.SttPg()) nFuncId = FN_START_OF_PAGE; @@ -272,9 +272,9 @@ IMPL_LINK( SwNavigationPI, ToolBoxSelectHdl, ToolBox *, pBox ) case FN_SELECT_FOOTNOTE: { rSh.MoveCrsr(); - const sal_uInt16 eFrmType = rSh.GetFrmType(0,false); + const FrmTypeFlags eFrmType = rSh.GetFrmType(0,false); // Jump from the footnote to the anchor. - if (eFrmType & FRMTYPE_FOOTNOTE) + if (eFrmType & FrmTypeFlags::FOOTNOTE) { if (rSh.GotoFtnAnchor()) nFuncId = FN_FOOTNOTE_TO_ANCHOR; diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 7916c271e039..24ab2c45b942 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -45,7 +45,7 @@ class ShellMoveCrsr public: inline ShellMoveCrsr( SwWrtShell* pWrtSh, bool bSel ) { - bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,false) & FRMTYPE_FLY_ANY); + bAct = !pWrtSh->ActionPend() && (pWrtSh->GetFrmType(0,false) & FrmTypeFlags::FLY_ANY); ( pSh = pWrtSh )->MoveCrsr( bSel ); pWrtSh->GetView().GetViewFrame()->GetBindings().Invalidate(SID_HYPERLINK_GETLINK); } @@ -237,15 +237,15 @@ bool SwWrtShell::GoStart( bool bKeepArea, bool *pMoveTable, else SttSelect(); } - const sal_uInt16 nFrmType = GetFrmType(0,false); - if ( FRMTYPE_FLY_ANY & nFrmType ) + const FrmTypeFlags nFrmType = GetFrmType(0,false); + if ( FrmTypeFlags::FLY_ANY & nFrmType ) { if( MoveSection( fnSectionCurr, fnSectionStart ) ) return true; - else if ( FRMTYPE_FLY_FREE & nFrmType || bDontMoveRegion ) + else if ( FrmTypeFlags::FLY_FREE & nFrmType || bDontMoveRegion ) return false; } - if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType ) + if(( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FOOTNOTE ) & nFrmType ) { if ( MoveSection( fnSectionCurr, fnSectionStart ) ) return true; @@ -270,15 +270,15 @@ bool SwWrtShell::GoEnd(bool bKeepArea, bool *pMoveTable) } else { - const sal_uInt16 nFrmType = GetFrmType(0,false); - if ( FRMTYPE_FLY_ANY & nFrmType ) + const FrmTypeFlags nFrmType = GetFrmType(0,false); + if ( FrmTypeFlags::FLY_ANY & nFrmType ) { if ( MoveSection( fnSectionCurr, fnSectionEnd ) ) return true; - else if ( FRMTYPE_FLY_FREE & nFrmType ) + else if ( FrmTypeFlags::FLY_FREE & nFrmType ) return false; } - if(( FRMTYPE_HEADER | FRMTYPE_FOOTER | FRMTYPE_FOOTNOTE ) & nFrmType ) + if(( FrmTypeFlags::HEADER | FrmTypeFlags::FOOTER | FrmTypeFlags::FOOTNOTE ) & nFrmType ) { if ( MoveSection( fnSectionCurr, fnSectionEnd) ) return true; |