summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-05-20 21:10:50 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-06-04 07:13:15 +0000
commit3d30077af27c8a6e91fb91175e6d2ea9a6f03d11 (patch)
treef0138734999835a0ebd342f87d5517017390de21
parent849278b952a3886f0196aac32f6fcf0c7ae72806 (diff)
convert GOTOOBJ constants to scoped enum
Change-Id: I2f44e780c7250cdbf40fde8779beb81f29498f8b Reviewed-on: https://gerrit.libreoffice.org/16071 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
-rw-r--r--sw/inc/fesh.hxx32
-rw-r--r--sw/source/core/frmedt/feshview.cxx21
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx2
-rw-r--r--sw/source/uibase/shells/txtcrsr.cxx4
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx10
5 files changed, 39 insertions, 30 deletions
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index b3bbfcda8aa9..d0c557ffc5eb 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -86,14 +86,22 @@ namespace o3tl
}
//! 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
-#define GOTOOBJ_FLY_FRM (sal_uInt16) 4
-#define GOTOOBJ_FLY_GRF (sal_uInt16) 8
-#define GOTOOBJ_FLY_OLE (sal_uInt16) 16
-#define GOTOOBJ_FLY_ANY (sal_uInt16) 28
-#define GOTOOBJ_GOTO_ANY (sal_uInt16) 31
+enum class GotoObjFlags
+{
+ NONE = 0,
+ DrawControl = 1,
+ DrawSimple = 2,
+ DrawAny = DrawControl | DrawSimple,
+ FlyFrm = 4,
+ FlyGrf = 8,
+ FlyOLE = 16,
+ FlyAny = FlyOLE | FlyGrf | FlyFrm,
+ Any = FlyAny | DrawAny,
+};
+namespace o3tl
+{
+ template<> struct typed_flags<GotoObjFlags> : is_typed_flags<GotoObjFlags, 31> {};
+}
//! values can be combined via logical or
#define FLYPROTECT_CONTENT (sal_uInt16) 1
@@ -381,9 +389,9 @@ public:
SwFrameFormat* WizzardGetFly();
/// Independent selecting of flys.
- bool GotoNextFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY )
+ bool GotoNextFly( GotoObjFlags eType = GotoObjFlags::FlyAny )
{ return GotoObj( true, eType ); }
- bool GotoPrevFly( sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_FLY_ANY)
+ bool GotoPrevFly( GotoObjFlags eType = GotoObjFlags::FlyAny)
{ return GotoObj( false, eType); }
/// Iterate over flys - for Basic-collections.
@@ -467,8 +475,8 @@ public:
bool GetObjAttr( SfxItemSet &rSet ) const;
bool SetObjAttr( const SfxItemSet &rSet );
- const SdrObject* GetBestObject( bool bNext, sal_uInt16 eType = GOTOOBJ_DRAW_ANY, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = NULL );
- bool GotoObj( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType = GOTOOBJ_DRAW_ANY);
+ const SdrObject* GetBestObject( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny, bool bFlat = true, const svx::ISdrObjectFilter* pFilter = NULL );
+ bool GotoObj( bool bNext, GotoObjFlags eType = GotoObjFlags::DrawAny);
/// Set DragMode (e.g. Rotate), but do nothing when frame is selected.
void SetDragMode( sal_uInt16 eSdrDragMode );
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index ab12724f2871..fe3ee4cf22e7 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1258,7 +1258,7 @@ namespace
};
}
-const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType, bool bFlat, const svx::ISdrObjectFilter* pFilter )
+const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool bFlat, const svx::ISdrObjectFilter* pFilter )
{
if( !Imp()->HasDrawView() )
return NULL;
@@ -1271,8 +1271,8 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...*
Point aTopPos( nTmp, nTmp );
Point aCurPos;
Point aPos;
- bool bNoDraw = 0 == (GOTOOBJ_DRAW_ANY & eType);
- bool bNoFly = 0 == (GOTOOBJ_FLY_ANY & eType);
+ bool bNoDraw(GotoObjFlags::DrawAny & eType);
+ bool bNoFly(GotoObjFlags::FlyAny & eType);
if( !bNoFly && bNoDraw )
{
@@ -1331,34 +1331,35 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...*
bool bFlyFrm = pObj->ISA(SwVirtFlyDrawObj);
if( ( bNoFly && bFlyFrm ) ||
( bNoDraw && !bFlyFrm ) ||
- ( eType == GOTOOBJ_DRAW_SIMPLE && lcl_IsControlGroup( pObj ) ) ||
- ( eType == GOTOOBJ_DRAW_CONTROL && !lcl_IsControlGroup( pObj ) ) ||
+ ( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) ||
+ ( eType == GotoObjFlags::DrawControl && !lcl_IsControlGroup( pObj ) ) ||
( pFilter && !pFilter->includeObject( *pObj ) ) )
continue;
if( bFlyFrm )
{
SwVirtFlyDrawObj *pO = static_cast<SwVirtFlyDrawObj*>(pObj);
SwFlyFrm *pFly = pO->GetFlyFrm();
- if( GOTOOBJ_FLY_ANY != ( GOTOOBJ_FLY_ANY & eType ) )
+ if( GotoObjFlags::FlyAny != ( GotoObjFlags::FlyAny & eType ) )
{
switch ( eType )
{
- case GOTOOBJ_FLY_FRM:
+ case GotoObjFlags::FlyFrm:
if ( pFly->Lower() && pFly->Lower()->IsNoTextFrm() )
continue;
break;
- case GOTOOBJ_FLY_GRF:
+ case GotoObjFlags::FlyGrf:
if ( pFly->Lower() &&
(pFly->Lower()->IsLayoutFrm() ||
!static_cast<SwContentFrm*>(pFly->Lower())->GetNode()->GetGrfNode()))
continue;
break;
- case GOTOOBJ_FLY_OLE:
+ case GotoObjFlags::FlyOLE:
if ( pFly->Lower() &&
(pFly->Lower()->IsLayoutFrm() ||
!static_cast<SwContentFrm*>(pFly->Lower())->GetNode()->GetOLENode()))
continue;
break;
+ default: break;
}
}
aCurPos = pFly->Frm().Pos();
@@ -1434,7 +1435,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, sal_uInt16 /*GOTOOBJ_...*
return pBest;
}
-bool SwFEShell::GotoObj( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType )
+bool SwFEShell::GotoObj( bool bNext, GotoObjFlags eType )
{
const SdrObject* pBest = GetBestObject( bNext, eType );
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 0ac4bfcd752e..4acc232c058e 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -2516,7 +2516,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
case KS_NextObject:
case KS_PrevObject:
- if(rSh.GotoObj( KS_NextObject == eKeyState, GOTOOBJ_GOTO_ANY))
+ if(rSh.GotoObj( KS_NextObject == eKeyState, GotoObjFlags::Any))
{
if( rSh.IsFrmSelected() &&
m_rView.GetDrawFuncPtr() )
diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx
index 61a45da1d28f..40680ef2a0c1 100644
--- a/sw/source/uibase/shells/txtcrsr.cxx
+++ b/sw/source/uibase/shells/txtcrsr.cxx
@@ -333,7 +333,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
if ( !pFilter.get() )
break;
- const SdrObject* pNearestControl = rSh.GetBestObject( true, GOTOOBJ_DRAW_CONTROL, false, pFilter.get() );
+ const SdrObject* pNearestControl = rSh.GetBestObject( true, GotoObjFlags::DrawControl, false, pFilter.get() );
if ( !pNearestControl )
break;
@@ -346,7 +346,7 @@ void SwTextShell::ExecMoveMisc(SfxRequest &rReq)
}
break;
case FN_CNTNT_TO_NEXT_FRAME:
- bRet = rSh.GotoObj(true, GOTOOBJ_GOTO_ANY);
+ bRet = rSh.GotoObj(true, GotoObjFlags::Any);
if(bRet)
{
rSh.HideCrsr();
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 03925bb4cbd0..83694f68f73f 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -335,11 +335,11 @@ IMPL_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
case NID_GRF:
case NID_OLE:
{
- sal_uInt16 eType = GOTOOBJ_FLY_FRM;
+ GotoObjFlags eType = GotoObjFlags::FlyFrm;
if(m_nMoveType == NID_GRF)
- eType = GOTOOBJ_FLY_GRF;
+ eType = GotoObjFlags::FlyGrf;
else if(m_nMoveType == NID_OLE)
- eType = GOTOOBJ_FLY_OLE;
+ eType = GotoObjFlags::FlyOLE;
bool bSuccess = bNext ?
rSh.GotoNextFly(eType) :
rSh.GotoPrevFly(eType);
@@ -354,8 +354,8 @@ IMPL_LINK( SwView, MoveNavigationHdl, bool *, pbNext )
case NID_CTRL:
rSh.GotoObj(bNext,
m_nMoveType == NID_DRW ?
- GOTOOBJ_DRAW_SIMPLE :
- GOTOOBJ_DRAW_CONTROL);
+ GotoObjFlags::DrawSimple :
+ GotoObjFlags::DrawControl);
break;
case NID_REG :
rSh.EnterStdMode();