[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin noelgrandin at gmail.com
Thu Jun 4 01:30:09 PDT 2015


 sw/inc/fesh.hxx                      |   23 +++++++++++++++--------
 sw/source/core/frmedt/feshview.cxx   |   32 ++++++++++++++++----------------
 sw/source/ui/frmdlg/frmpage.cxx      |    2 +-
 sw/source/uibase/dochdl/swdtflvr.cxx |    2 +-
 sw/source/uibase/docvw/edtdd.cxx     |    2 +-
 sw/source/uibase/docvw/edtwin.cxx    |   20 ++++++++++----------
 sw/source/uibase/shells/basesh.cxx   |   18 +++++++++---------
 sw/source/uibase/shells/drawsh.cxx   |    4 ++--
 sw/source/uibase/shells/drwbassh.cxx |    6 +++---
 sw/source/uibase/shells/frmsh.cxx    |   12 ++++++------
 sw/source/uibase/shells/grfsh.cxx    |    6 +++---
 sw/source/uibase/uiview/view.cxx     |    2 +-
 sw/source/uibase/uiview/viewdraw.cxx |    2 +-
 sw/source/uibase/uiview/viewstat.cxx |    6 +++---
 sw/source/uibase/uiview/viewtab.cxx  |    8 ++++----
 15 files changed, 76 insertions(+), 69 deletions(-)

New commits:
commit 407c6c871ea53d9fb97c50e1ee24db7a8e5d70e1
Author: Noel Grandin <noelgrandin at gmail.com>
Date:   Mon Jun 1 20:58:44 2015 +0200

    replace FLYPROTECT with scoped enum
    
    Change-Id: I665d2944f5d24b4ec5015274c1b95b106a028291
    Reviewed-on: https://gerrit.libreoffice.org/16072
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index d0c557f..14112a6 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -104,12 +104,20 @@ namespace o3tl
 }
 
 //! 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
-#define FLYPROTECT_PARENT       (sal_uInt16)  8     ///< Check only parents.
-#define FLYPROTECT_FIXED        (sal_uInt16) 16     /**< Only protection that cannot be withdrawn
+enum class FlyProtectFlags
+{
+    NONE         = 0,
+    Content      = 1,
+    Size         = 2,
+    Pos          = 4,
+    Parent       = 8,      ///< Check only parents.
+    Fixed        = 16,    /**< Only protection that cannot be withdrawn
                                                     e.g. by OLE-server; also relevant for dialog. */
+};
+namespace o3tl
+{
+    template<> struct typed_flags<FlyProtectFlags> : is_typed_flags<FlyProtectFlags, 31> {};
+}
 
 // For figuring out contents by position (D&D)
 enum ObjCntType
@@ -353,9 +361,8 @@ public:
     /// @return a format too, if the point is over the text of any fly.
     const SwFrameFormat* GetFormatFromAnyObj( const Point& rPt ) const;
 
-    /** Which Protection is set at selected object?
-     returns several flags in sal_uInt8 */
-    sal_uInt8 IsSelObjProtected( sal_uInt16 /*FLYPROTECT_...*/ eType ) const;
+    /** Which Protection is set at selected object? */
+    FlyProtectFlags IsSelObjProtected( FlyProtectFlags eType ) const;
 
     /** Deliver graphic in rName besides graphic name. If graphic is
      linked give name with path. rbLink is TRUE if graphic is linked. */
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index fe3ee4c..87661a8 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -2343,10 +2343,10 @@ void SwFEShell::MakeSelVisible()
 }
 
 // how is the selected object protected?
-sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const
+FlyProtectFlags SwFEShell::IsSelObjProtected( FlyProtectFlags eType ) const
 {
-    int nChk = 0;
-    const bool bParent = (eType & FLYPROTECT_PARENT);
+    FlyProtectFlags nChk = FlyProtectFlags::NONE;
+    const bool bParent(eType & FlyProtectFlags::Parent);
     if( Imp()->HasDrawView() )
     {
         const SdrMarkList &rMrkList = Imp()->GetDrawView()->GetMarkedObjectList();
@@ -2355,14 +2355,14 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const
             SdrObject *pObj = rMrkList.GetMark( --i )->GetMarkedSdrObj();
             if( !bParent )
             {
-                nChk |= ( pObj->IsMoveProtect() ? FLYPROTECT_POS : 0 ) |
-                        ( pObj->IsResizeProtect()? FLYPROTECT_SIZE : 0 );
+                nChk |= ( pObj->IsMoveProtect() ? FlyProtectFlags::Pos : FlyProtectFlags::NONE ) |
+                        ( pObj->IsResizeProtect()? FlyProtectFlags::Size : FlyProtectFlags::NONE );
 
                 if( pObj->ISA(SwVirtFlyDrawObj) )
                 {
                     SwFlyFrm *pFly = static_cast<SwVirtFlyDrawObj*>(pObj)->GetFlyFrm();
-                    if ( (FLYPROTECT_CONTENT & eType) && pFly->GetFormat()->GetProtect().IsContentProtected() )
-                        nChk |= FLYPROTECT_CONTENT;
+                    if ( (FlyProtectFlags::Content & eType) && pFly->GetFormat()->GetProtect().IsContentProtected() )
+                        nChk |= FlyProtectFlags::Content;
 
                     if ( pFly->Lower() && pFly->Lower()->IsNoTextFrm() )
                     {
@@ -2372,24 +2372,24 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const
                         {
                             // TODO/LATER: use correct aspect
                             const bool bNeverResize = (embed::EmbedMisc::EMBED_NEVERRESIZE & xObj->getStatus( embed::Aspects::MSOLE_CONTENT ));
-                            if ( ( (FLYPROTECT_CONTENT & eType) || (FLYPROTECT_SIZE & eType) ) && bNeverResize )
+                            if ( ( (FlyProtectFlags::Content & eType) || (FlyProtectFlags::Size & eType) ) && bNeverResize )
                             {
-                                nChk |= FLYPROTECT_SIZE;
-                                nChk |= FLYPROTECT_FIXED;
+                                nChk |= FlyProtectFlags::Size;
+                                nChk |= FlyProtectFlags::Fixed;
                             }
 
-                            // set FLYPROTECT_POS if it is a Math object anchored 'as char' and baseline alignment is activated
+                            // set FlyProtectFlags::Pos if it is a Math object anchored 'as char' and baseline alignment is activated
                             const bool bProtectMathPos = SotExchange::IsMath( xObj->getClassID() )
                                     && FLY_AS_CHAR == pFly->GetFormat()->GetAnchor().GetAnchorId()
                                     && mpDoc->GetDocumentSettingManager().get( DocumentSettingId::MATH_BASELINE_ALIGNMENT );
-                            if ((FLYPROTECT_POS & eType) && bProtectMathPos)
-                                nChk |= FLYPROTECT_POS;
+                            if ((FlyProtectFlags::Pos & eType) && bProtectMathPos)
+                                nChk |= FlyProtectFlags::Pos;
                         }
                     }
                 }
                 nChk &= eType;
                 if( nChk == eType )
-                    return static_cast<sal_uInt8>(eType);
+                    return eType;
             }
             const SwFrm* pAnch;
             if( pObj->ISA(SwVirtFlyDrawObj) )
@@ -2400,10 +2400,10 @@ sal_uInt8 SwFEShell::IsSelObjProtected( sal_uInt16 eType ) const
                 pAnch = pTmp ? pTmp->GetAnchorFrm( pObj ) : NULL;
             }
             if( pAnch && pAnch->IsProtected() )
-                return static_cast<sal_uInt8>(eType);
+                return eType;
         }
     }
-    return static_cast<sal_uInt8>(nChk);
+    return nChk;
 }
 
 bool SwFEShell::GetObjAttr( SfxItemSet &rSet ) const
diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx
index f756ad9..ae47f51 100644
--- a/sw/source/ui/frmdlg/frmpage.cxx
+++ b/sw/source/ui/frmdlg/frmpage.cxx
@@ -2161,7 +2161,7 @@ void SwFrmPage::Init(const SfxItemSet& rSet, bool bReset)
         SwWrtShell* pSh = getFrmDlgParentShell();
 
         // size
-        const bool bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED );
+        const bool bSizeFixed = pSh->IsSelObjProtected( FlyProtectFlags::Fixed ) != FlyProtectFlags::NONE;
 
         m_aWidthED .Enable( !bSizeFixed );
         m_aHeightED.Enable( !bSizeFixed );
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 5e00968..c8af011 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -3360,7 +3360,7 @@ bool SwTransferable::PrivateDrop( SwWrtShell& rSh, const Point& rDragPt,
     else if( rSrcSh.IsSelFrmMode() || rSrcSh.IsObjSelected() )
     {
         // don't move position-protected objects!
-        if( bMove && rSrcSh.IsSelObjProtected( FLYPROTECT_POS ) )
+        if( bMove && rSrcSh.IsSelObjProtected( FlyProtectFlags::Pos ) != FlyProtectFlags::NONE )
             return false;
 
         bFrmSel = true;
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 92c5764..460a603 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -404,7 +404,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
             }
             // don't more position protected objects!
             else if( DND_ACTION_MOVE == rEvt.mnAction &&
-                     pSrcSh->IsSelObjProtected( FLYPROTECT_POS ) )
+                     pSrcSh->IsSelObjProtected( FlyProtectFlags::Pos ) != FlyProtectFlags::NONE )
             {
                 bCleanup = true;
             }
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 4acc232..d2c42ae 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -489,7 +489,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
                             bool bMovable =
                                 (!bNotInSelObj) &&
                                 (rSh.IsObjSelected() || rSh.IsFrmSelected()) &&
-                                (!rSh.IsSelObjProtected(FLYPROTECT_POS));
+                                (rSh.IsSelObjProtected(FlyProtectFlags::Pos) == FlyProtectFlags::NONE);
 
                             SdrObject* pSelectableObj = rSh.GetObjAt(rLPt);
                             // Don't update pointer if this is a background image only.
@@ -511,7 +511,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
                         // if( rSh.IsObjSelectable(rLPt) ) must always be true:
                         // rLPt is inside a selected object, then obviously
                         // rLPt is over a selectable object.
-                        if (rSh.IsSelObjProtected(FLYPROTECT_SIZE))
+                        if (rSh.IsSelObjProtected(FlyProtectFlags::Size) != FlyProtectFlags::NONE)
                             eStyle = PointerStyle::NotAllowed;
                         else
                             eStyle = PointerStyle::Move;
@@ -530,7 +530,7 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier )
     }
     if ( bPrefSdrPointer )
     {
-        if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FLYPROTECT_CONTENT)))
+        if (bIsDocReadOnly || (rSh.IsObjSelected() && rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE))
             SetPointer( PointerStyle::NotAllowed );
         else
         {
@@ -987,7 +987,7 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
     SwWrtShell &rSh = m_rView.GetWrtShell();
     SwRect aTmp = rSh.GetFlyRect();
     if( aTmp.HasArea() &&
-        !rSh.IsSelObjProtected( FLYPROTECT_POS ) )
+        rSh.IsSelObjProtected( FlyProtectFlags::Pos ) == FlyProtectFlags::NONE )
     {
         SfxItemSet aSet(rSh.GetAttrPool(),
                         RES_FRM_SIZE, RES_FRM_SIZE,
@@ -1217,7 +1217,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
 
     if(0 != nX || 0 != nY)
     {
-        sal_uInt8 nProtect = rSh.IsSelObjProtected( FLYPROTECT_POS|FLYPROTECT_SIZE );
+        FlyProtectFlags nProtect = rSh.IsSelObjProtected( FlyProtectFlags::Pos|FlyProtectFlags::Size );
         Size aSnap( rSh.GetViewOptions()->GetSnapSize() );
         short nDiv = rSh.GetViewOptions()->GetDivisionX();
         if ( nDiv > 0 )
@@ -1247,7 +1247,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
         {
             // now move the selected draw objects
             // if the object's position is not protected
-            if(0 == (nProtect&FLYPROTECT_POS))
+            if(!(nProtect&FlyProtectFlags::Pos))
             {
                 // Check if object is anchored as character and move direction
                 bool bDummy1, bDummy2;
@@ -1271,11 +1271,11 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
                     HDL_ANCHOR_TR == pHdl->GetKind() )
                 {
                     // anchor move cannot be allowed when position is protected
-                    if(0 == (nProtect&FLYPROTECT_POS))
+                    if(!(nProtect&FlyProtectFlags::Pos))
                         rSh.MoveAnchor( nAnchorDir );
                 }
                 //now resize if size is protected
-                else if(0 == (nProtect&FLYPROTECT_SIZE))
+                else if(!(nProtect&FlyProtectFlags::Size))
                 {
                     // now move the Handle (nX, nY)
                     Point aStartPoint(pHdl->GetPos());
@@ -3235,7 +3235,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
                     {
                         g_bFrmDrag = false;
                         if ( !bHandledFlyClick && !bIsDocReadOnly && rSh.IsInsideSelectedObj(aDocPos) &&
-                             0 == rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
+                             FlyProtectFlags::NONE == rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) )
                         {
                         /* This is no good: on the one hand GetSelectionType is used as flag field
                          * (take a look into the GetSelectionType method) and on the other hand the
@@ -3255,7 +3255,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
 
                             // double click on OLE object --> OLE-InPlace
                             case nsSelectionType::SEL_OLE:
-                                if (!rSh.IsSelObjProtected(FLYPROTECT_CONTENT))
+                                if (rSh.IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE)
                                 {
                                     RstMBDownFlags();
                                     rSh.LaunchOLEObj();
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 5adf4ed..2102494 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -262,7 +262,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
                 SwTransferable* pTransfer = new SwTransferable( rSh );
 /*??*/          uno::Reference< datatransfer::XTransferable > xRef( pTransfer );
 
-                if ( nId == SID_CUT && !rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT) )
+                if ( nId == SID_CUT && FlyProtectFlags::NONE == rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent) )
                     pTransfer->Cut();
                 else
                 {
@@ -417,7 +417,7 @@ void SwBaseShell::StateClpbrd(SfxItemSet &rSet)
         switch(nWhich)
         {
         case SID_CUT:
-            if( 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) )
+            if( FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent ) )
             {
                 rSet.DisableItem( nWhich );
                 break;
@@ -1230,7 +1230,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl)
         GRAPHIC_NONE != ( nGrfType = rSh.GetGraphicType() ) &&
         !aGrfUpdateSlots.empty() )
     {
-        bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
+        bool bProtect = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent);
         SfxViewFrame* pVFrame = GetView().GetViewFrame();
         sal_uInt16 nSlot;
         std::set<sal_uInt16>::iterator it;
@@ -1404,7 +1404,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                 // #i59688#
                 // Improve efficiency:
                 // If selected object is protected, item has to disabled.
-                const bool bProtect = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT);
+                const bool bProtect = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent);
                 if ( bProtect )
                 {
                     rSet.DisableItem( nWhich );
@@ -1476,7 +1476,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
             case FN_BACKSPACE:
             case SID_DELETE:
                 if ( ( rSh.HasReadonlySel() && !rSh.CrsrInsideInputField() )
-                     || rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0 )
+                     || rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE )
                 {
                     rSet.DisableItem( nWhich );
                 }
@@ -1484,7 +1484,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
 
             case SID_CONTOUR_DLG:
             {
-                bool bParentCntProt = 0 != rSh.IsSelObjProtected(FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+                bool bParentCntProt = FlyProtectFlags::NONE != rSh.IsSelObjProtected(FlyProtectFlags::Content|FlyProtectFlags::Parent );
 
                 if( bParentCntProt || 0 != (HTMLMODE_ON & ::GetHtmlMode(
                                             GetView().GetDocShell() )) )
@@ -1557,7 +1557,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
             case FN_TOOL_ANCHOR_FRAME:
             {
                 bool bObj = 0 != rSh.IsObjSelected();
-                bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+                bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
                 if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
                 {
@@ -1627,7 +1627,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
             case FN_FRAME_WRAP_RIGHT:
             {
                 bool bObj = 0 != rSh.IsObjSelected();
-                bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+                bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
                 if( !bParentCntProt && (bObj || rSh.IsFrmSelected()))
                 {
@@ -1779,7 +1779,7 @@ void SwBaseShell::StateDisableItems( SfxItemSet &rSet )
 
 void SwBaseShell::StateStyle( SfxItemSet &rSet )
 {
-    bool bParentCntProt = GetShell().IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+    bool bParentCntProt = GetShell().IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
     ShellModes eMode = GetView().GetShellMode();
 
     if ( bParentCntProt ||
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index 28c8d96..460a68b 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -401,10 +401,10 @@ void SwDrawShell::GetState(SfxItemSet& rSet)
     SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
     SfxWhichIter aIter( rSet );
     sal_uInt16 nWhich = aIter.FirstWhich();
-    bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
+    bool bProtected = rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
 
     if (!bProtected)    // Check the parent
-        bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+        bProtected |= rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
     while( nWhich )
     {
diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx
index bf405b0..4e8637e 100644
--- a/sw/source/uibase/shells/drwbassh.cxx
+++ b/sw/source/uibase/shells/drwbassh.cxx
@@ -627,10 +627,10 @@ void SwDrawBaseShell::GetState(SfxItemSet& rSet)
     SdrView* pSdrView = rSh.GetDrawViewWithValidMarkList();
     SfxWhichIter aIter( rSet );
     sal_uInt16 nWhich = aIter.FirstWhich();
-    bool bProtected = rSh.IsSelObjProtected(FLYPROTECT_CONTENT);
+    bool bProtected = rSh.IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
 
     if (!bProtected)    // Look in the parent
-        bProtected |= rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+        bProtected |= rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
     while( nWhich )
     {
@@ -727,7 +727,7 @@ void SwDrawBaseShell::GetDrawAttrStateForIFBX( SfxItemSet& rSet )
 
 bool SwDrawBaseShell::Disable(SfxItemSet& rSet, sal_uInt16 nWhich)
 {
-    bool bDisable = GetShell().IsSelObjProtected(FLYPROTECT_CONTENT);
+    bool bDisable = GetShell().IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE;
 
     if (bDisable)
     {
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index d42f0e9..f9ea90d 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -675,8 +675,8 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
                             0 );
         rSh.GetFlyFrmAttr( aSet );
 
-        bool bProtect = rSh.IsSelObjProtected(FLYPROTECT_POS);
-        bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+        bool bProtect = rSh.IsSelObjProtected(FlyProtectFlags::Pos) != FlyProtectFlags::NONE;
+        bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
         bProtect |= bParentCntProt;
 
@@ -875,9 +875,9 @@ void SwFrameShell::GetState(SfxItemSet& rSet)
 
                 case SID_ATTR_TRANSFORM_PROTECT_SIZE:
                 {
-                    const sal_uInt8 eProtection = rSh.IsSelObjProtected( FLYPROTECT_SIZE );
-                    if ( ( eProtection & FLYPROTECT_CONTENT ) ||
-                         ( eProtection & FLYPROTECT_SIZE ) )
+                    const FlyProtectFlags eProtection = rSh.IsSelObjProtected( FlyProtectFlags::Size );
+                    if ( ( eProtection & FlyProtectFlags::Content ) ||
+                         ( eProtection & FlyProtectFlags::Size ) )
                     {
                         rSet.Put( SfxBoolItem( SID_ATTR_TRANSFORM_PROTECT_SIZE, true ) );
                     }
@@ -1137,7 +1137,7 @@ static void lcl_FrmGetMaxLineWidth(const SvxBorderLine* pBorderLine, SvxBorderLi
 void SwFrameShell::GetLineStyleState(SfxItemSet &rSet)
 {
     SwWrtShell &rSh = GetShell();
-    bool bParentCntProt = rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT ) != 0;
+    bool bParentCntProt = rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent ) != FlyProtectFlags::NONE;
 
     if (bParentCntProt)
     {
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index b855277..c05d1ce 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -648,7 +648,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
     SwWrtShell &rSh = GetShell();
     SfxItemSet aCoreSet( GetPool(), aNoTextNodeSetRange );
     rSh.GetCurAttr( aCoreSet );
-    bool bParentCntProt = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+    bool bParentCntProt = FlyProtectFlags::NONE != rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent );
     bool bIsGrfContent = CNT_GRF == GetShell().GetCntType();
 
     SetGetStateSet( &rSet );
@@ -814,7 +814,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
 
         case SID_OBJECT_CROP:
             {
-                bDisable = 0 != rSh.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+                bDisable = FlyProtectFlags::NONE != rSh.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent );
                 if( rSh.GetGraphicType() == GRAPHIC_NONE )
                     bDisable = true;
             }
@@ -894,7 +894,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq)
 void SwGrfShell::GetAttrStateForRotation(SfxItemSet &rSet)
 {
     SwWrtShell& rShell = GetShell();
-    bool bIsParentContentProtected = 0 != rShell.IsSelObjProtected( FLYPROTECT_CONTENT|FLYPROTECT_PARENT );
+    bool bIsParentContentProtected = FlyProtectFlags::NONE != rShell.IsSelObjProtected( FlyProtectFlags::Content|FlyProtectFlags::Parent );
 
     SetGetStateSet( &rSet );
 
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index c767a6a..52f9cc7 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -151,7 +151,7 @@ void SwView::ImpSetVerb( int nSelType )
     if ( !GetViewFrame()->GetFrame().IsInPlace() &&
          (nsSelectionType::SEL_OLE|nsSelectionType::SEL_GRF) & nSelType )
     {
-        if ( !m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT) )
+        if ( m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE )
         {
             if ( nSelType & nsSelectionType::SEL_OLE )
             {
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 36d5907..7540776 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -492,7 +492,7 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
           ( pObj->ISA(SwDrawVirtObj) &&
             static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) &&
 
-        !m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
+        m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) == FlyProtectFlags::NONE )
     {
         // Refuse to edit editeng text of the shape if it has textbox attached.
         if (!lcl_isTextBox(pObj))
diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx
index 2d9b035..1315f68 100644
--- a/sw/source/uibase/uiview/viewstat.cxx
+++ b/sw/source/uibase/uiview/viewstat.cxx
@@ -80,7 +80,7 @@ void SwView::GetState(SfxItemSet &rSet)
             if( m_pWrtShell->GetLinkManager().GetLinks().empty() )
                 rSet.DisableItem(nWhich);
             else if( m_pWrtShell->IsSelFrmMode() &&
-                m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
+                m_pWrtShell->IsSelObjProtected(FlyProtectFlags::Content) != FlyProtectFlags::NONE)
             {
                 rSet.DisableItem(nWhich);
             }
@@ -108,8 +108,8 @@ void SwView::GetState(SfxItemSet &rSet)
                         rSet.DisableItem(nWhich);
                     }
                     else if((m_pWrtShell->IsObjSelected() || m_pWrtShell->IsFrmSelected()) &&
-                        (m_pWrtShell->IsSelObjProtected( FLYPROTECT_PARENT)||
-                        m_pWrtShell->IsSelObjProtected( FLYPROTECT_CONTENT )))
+                        (m_pWrtShell->IsSelObjProtected( FlyProtectFlags::Parent) != FlyProtectFlags::NONE ||
+                        m_pWrtShell->IsSelObjProtected( FlyProtectFlags::Content ) != FlyProtectFlags::NONE))
                     {
                         rSet.DisableItem(nWhich);
                     }
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index 7dac67e..5245344 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -2011,12 +2011,12 @@ void SwView::StateTabWin(SfxItemSet& rSet)
         {
             if(bFrmSelection)
             {
-                sal_uInt8 nProtect = m_pWrtShell->IsSelObjProtected( FLYPROTECT_SIZE|FLYPROTECT_POS|FLYPROTECT_CONTENT );
+                FlyProtectFlags nProtect = m_pWrtShell->IsSelObjProtected( FlyProtectFlags::Size|FlyProtectFlags::Pos|FlyProtectFlags::Content );
 
                 SvxProtectItem aProt(SID_RULER_PROTECT);
-                aProt.SetContentProtect((nProtect & FLYPROTECT_CONTENT)   != 0);
-                aProt.SetSizeProtect ((nProtect & FLYPROTECT_SIZE)      != 0);
-                aProt.SetPosProtect  ((nProtect & FLYPROTECT_POS)       != 0);
+                aProt.SetContentProtect(bool(nProtect & FlyProtectFlags::Content));
+                aProt.SetSizeProtect   (bool(nProtect & FlyProtectFlags::Size));
+                aProt.SetPosProtect    (bool(nProtect & FlyProtectFlags::Pos));
                 rSet.Put(aProt);
             }
             else


More information about the Libreoffice-commits mailing list