Kaydet (Commit) 3d30077a authored tarafından Noel Grandin's avatar Noel Grandin

convert GOTOOBJ constants to scoped enum

Change-Id: I2f44e780c7250cdbf40fde8779beb81f29498f8b
Reviewed-on: https://gerrit.libreoffice.org/16071Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 849278b9
......@@ -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 );
......
......@@ -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 );
......
......@@ -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() )
......
......@@ -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();
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment