diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-10 15:36:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-02-13 08:17:42 +0200 |
commit | 80d2fa87fdaf67615d7b8128f3c05b239a1f1c05 (patch) | |
tree | 86fbf89631b4c82228e48ffd04da9ba776c07cb0 /sw | |
parent | f0c57266709509ae24cfb1615d136263fb1e8d60 (diff) |
convert IsAttrAtPos to scoped o3tl::typed_flags
Change-Id: Ie3a361a96201cb1a0ab446bcf77b7c0e79e05e89
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/crsrsh.hxx | 52 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 78 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/dochdl/swdtflvr.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/docvw/SidebarTxtControl.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtdd.cxx | 4 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 64 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin2.cxx | 40 | ||||
-rw-r--r-- | sw/source/uibase/docvw/romenu.cxx | 2 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 2 |
10 files changed, 129 insertions, 125 deletions
diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 66718855192c..bcb9eb4a7357 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -24,6 +24,7 @@ #include <rtl/ustring.hxx> #include <tools/link.hxx> #include <vcl/keycod.hxx> +#include <o3tl/typed_flags_set.hxx> #include <IShellCursorSupplier.hxx> #include "swdllapi.h" @@ -80,29 +81,34 @@ namespace com { namespace sun { namespace star { namespace container { // enum and struct to get information via the Doc-Position -struct SwContentAtPos +enum class IsAttrAtPos { - enum IsAttrAtPos - { - SW_NOTHING = 0x0000, - SW_FIELD = 0x0001, - SW_CLICKFIELD = 0x0002, - SW_FTN = 0x0004, - SW_INETATTR = 0x0008, - SW_TABLEBOXFML = 0x0010, - SW_REDLINE = 0x0020, - SW_OUTLINE = 0x0040, - SW_TOXMARK = 0x0080, - SW_REFMARK = 0x0100, - SW_NUMLABEL = 0x0200, - SW_CONTENT_CHECK = 0x0400, - SW_SMARTTAG = 0x0800, - SW_FORMCTRL = 0x1000 + NONE = 0x0000, + Field = 0x0001, + ClickField = 0x0002, + Ftn = 0x0004, + InetAttr = 0x0008, + TableBoxFml = 0x0010, + Redline = 0x0020, + Outline = 0x0040, + ToxMark = 0x0080, + RefMark = 0x0100, + NumLabel = 0x0200, + ContentCheck = 0x0400, + SmartTag = 0x0800, + FormControl = 0x1000 #ifdef DBG_UTIL - ,SW_CURR_ATTRS = 0x4000 ///< only for debugging - ,SW_TABLEBOXVALUE = 0x8000 ///< only for debugging + ,CurrAttrs = 0x2000 ///< only for debugging + ,TableBoxValue = 0x4000 ///< only for debugging #endif - } eContentAtPos; +}; +namespace o3tl { + template<> struct typed_flags<IsAttrAtPos> : is_typed_flags<IsAttrAtPos, 0x7fff> {}; +} + +struct SwContentAtPos +{ + IsAttrAtPos eContentAtPos; union { const SwField* pField; @@ -117,8 +123,8 @@ struct SwContentAtPos OUString sStr; const SwTextAttr* pFndTextAttr; - SwContentAtPos( int eGetAtPos ) - : eContentAtPos( (IsAttrAtPos)eGetAtPos ) + SwContentAtPos( IsAttrAtPos eGetAtPos ) + : eContentAtPos( eGetAtPos ) { aFnd.pField = nullptr; pFndTextAttr = nullptr; @@ -126,7 +132,7 @@ struct SwContentAtPos } bool IsInProtectSect() const; - bool IsInRTLText()const; + bool IsInRTLText() const; }; // return values of SetCursor (can be combined via ||) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 4424cf40c706..a9858e192947 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1132,12 +1132,12 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, SwTextAttr* pTextAttr; SwCursorMoveState aTmpState; aTmpState.m_bFieldInfo = true; - aTmpState.m_bExactOnly = !( SwContentAtPos::SW_OUTLINE & rContentAtPos.eContentAtPos ); - aTmpState.m_bContentCheck = (SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos) != 0; + aTmpState.m_bExactOnly = !( IsAttrAtPos::Outline & rContentAtPos.eContentAtPos ); + aTmpState.m_bContentCheck = bool(IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos); aTmpState.m_bSetInReadOnly = IsReadOnlyAvailable(); SwSpecialPos aSpecialPos; - aTmpState.m_pSpecialPos = ( SwContentAtPos::SW_SMARTTAG & rContentAtPos.eContentAtPos ) ? + aTmpState.m_pSpecialPos = ( IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos ) ? &aSpecialPos : nullptr; const bool bCursorFoundExact = GetLayout()->GetCursorOfst( &aPos, aPt, &aTmpState ); @@ -1145,24 +1145,24 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, const SwNodes& rNds = GetDoc()->GetNodes(); if( pTextNd - && SwContentAtPos::SW_OUTLINE & rContentAtPos.eContentAtPos + && IsAttrAtPos::Outline & rContentAtPos.eContentAtPos && !rNds.GetOutLineNds().empty() ) { const SwTextNode* pONd = pTextNd->FindOutlineNodeOfLevel( MAXLEVEL-1); if( pONd ) { - rContentAtPos.eContentAtPos = SwContentAtPos::SW_OUTLINE; + rContentAtPos.eContentAtPos = IsAttrAtPos::Outline; rContentAtPos.sStr = pONd->GetExpandText( 0, -1, true, true ); bRet = true; } } - else if ( SwContentAtPos::SW_CONTENT_CHECK & rContentAtPos.eContentAtPos + else if ( IsAttrAtPos::ContentCheck & rContentAtPos.eContentAtPos && bCursorFoundExact ) { bRet = true; } else if( pTextNd - && SwContentAtPos::SW_NUMLABEL & rContentAtPos.eContentAtPos) + && IsAttrAtPos::NumLabel & rContentAtPos.eContentAtPos) { bRet = aTmpState.m_bInNumPortion; rContentAtPos.aFnd.pNode = pTextNd; @@ -1176,7 +1176,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, if( !aTmpState.m_bPosCorr ) { if ( !bRet - && SwContentAtPos::SW_SMARTTAG & rContentAtPos.eContentAtPos + && IsAttrAtPos::SmartTag & rContentAtPos.eContentAtPos && !aTmpState.m_bFootnoteNoInfo ) { const SwWrongList* pSmartTagList = pTextNd->GetSmartTags(); @@ -1211,7 +1211,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if( bRet ) { - rContentAtPos.eContentAtPos = SwContentAtPos::SW_SMARTTAG; + rContentAtPos.eContentAtPos = IsAttrAtPos::SmartTag; if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) pFrame->GetCharRect( *pFieldRect, aPos, &aTmpState ); @@ -1220,14 +1220,14 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if ( !bRet - && ( SwContentAtPos::SW_FIELD | SwContentAtPos::SW_CLICKFIELD ) & rContentAtPos.eContentAtPos + && ( IsAttrAtPos::Field | IsAttrAtPos::ClickField ) & rContentAtPos.eContentAtPos && !aTmpState.m_bFootnoteNoInfo ) { pTextAttr = pTextNd->GetFieldTextAttrAt( aPos.nContent.GetIndex() ); const SwField* pField = pTextAttr != nullptr ? pTextAttr->GetFormatField().GetField() : nullptr; - if ( SwContentAtPos::SW_CLICKFIELD & rContentAtPos.eContentAtPos + if ( IsAttrAtPos::ClickField & rContentAtPos.eContentAtPos && pField && !pField->HasClickHdl() ) { pField = nullptr; @@ -1248,7 +1248,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, { // allow click fields in protected sections // only placeholder is not possible - if( SwContentAtPos::SW_FIELD & rContentAtPos.eContentAtPos + if( IsAttrAtPos::Field & rContentAtPos.eContentAtPos || RES_JUMPEDITFLD == pField->Which() ) pField = nullptr; } @@ -1270,23 +1270,23 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, { rContentAtPos.aFnd.pField = pField; rContentAtPos.pFndTextAttr = pTextAttr; - rContentAtPos.eContentAtPos = SwContentAtPos::SW_FIELD; + rContentAtPos.eContentAtPos = IsAttrAtPos::Field; bRet = true; } } - if( !bRet && SwContentAtPos::SW_FORMCTRL & rContentAtPos.eContentAtPos ) + if( !bRet && IsAttrAtPos::FormControl & rContentAtPos.eContentAtPos ) { IDocumentMarkAccess* pMarksAccess = GetDoc()->getIDocumentMarkAccess( ); sw::mark::IFieldmark* pFieldBookmark = pMarksAccess->getFieldmarkFor( aPos ); if( bCursorFoundExact && pTextNd && pFieldBookmark) { - rContentAtPos.eContentAtPos = SwContentAtPos::SW_FORMCTRL; + rContentAtPos.eContentAtPos = IsAttrAtPos::FormControl; rContentAtPos.aFnd.pFieldmark = pFieldBookmark; bRet=true; } } - if( !bRet && SwContentAtPos::SW_FTN & rContentAtPos.eContentAtPos ) + if( !bRet && IsAttrAtPos::Ftn & rContentAtPos.eContentAtPos ) { if( aTmpState.m_bFootnoteNoInfo ) { @@ -1299,7 +1299,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, bRet = false; } if( bRet ) - rContentAtPos.eContentAtPos = SwContentAtPos::SW_FTN; + rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn; } else if ( nullptr != ( pTextAttr = pTextNd->GetTextAttrForCharAt( aPos.nContent.GetIndex(), RES_TXTATR_FTN )) ) @@ -1329,7 +1329,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, if( bRet ) { - rContentAtPos.eContentAtPos = SwContentAtPos::SW_FTN; + rContentAtPos.eContentAtPos = IsAttrAtPos::Ftn; rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); @@ -1340,11 +1340,11 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if( !bRet - && ( SwContentAtPos::SW_TOXMARK | SwContentAtPos::SW_REFMARK ) & rContentAtPos.eContentAtPos + && ( IsAttrAtPos::ToxMark | IsAttrAtPos::RefMark ) & rContentAtPos.eContentAtPos && !aTmpState.m_bFootnoteNoInfo ) { pTextAttr = nullptr; - if( SwContentAtPos::SW_TOXMARK & rContentAtPos.eContentAtPos ) + if( IsAttrAtPos::ToxMark & rContentAtPos.eContentAtPos ) { std::vector<SwTextAttr *> const marks( pTextNd->GetTextAttrsAt( @@ -1356,7 +1356,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if( !pTextAttr && - SwContentAtPos::SW_REFMARK & rContentAtPos.eContentAtPos ) + IsAttrAtPos::RefMark & rContentAtPos.eContentAtPos ) { std::vector<SwTextAttr *> const marks( pTextNd->GetTextAttrsAt( @@ -1394,8 +1394,8 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.eContentAtPos = RES_TXTATR_TOXMARK == pTextAttr->Which() - ? SwContentAtPos::SW_TOXMARK - : SwContentAtPos::SW_REFMARK; + ? IsAttrAtPos::ToxMark + : IsAttrAtPos::RefMark; rContentAtPos.pFndTextAttr = pTextAttr; rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); @@ -1406,7 +1406,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if ( !bRet - && SwContentAtPos::SW_INETATTR & rContentAtPos.eContentAtPos + && IsAttrAtPos::InetAttr & rContentAtPos.eContentAtPos && !aTmpState.m_bFootnoteNoInfo ) { pTextAttr = pTextNd->GetTextAttrAt( @@ -1435,7 +1435,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, rContentAtPos.sStr = pTextNd->GetExpandText(nSt, nEnd-nSt); rContentAtPos.aFnd.pAttr = &pTextAttr->GetAttr(); - rContentAtPos.eContentAtPos = SwContentAtPos::SW_INETATTR; + rContentAtPos.eContentAtPos = IsAttrAtPos::InetAttr; rContentAtPos.pFndTextAttr = pTextAttr; if( pFieldRect && nullptr != ( pFrame = pTextNd->getLayoutFrame( GetLayout(), &aPt ) ) ) @@ -1452,13 +1452,13 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } } - if( !bRet && SwContentAtPos::SW_REDLINE & rContentAtPos.eContentAtPos ) + if( !bRet && IsAttrAtPos::Redline & rContentAtPos.eContentAtPos ) { const SwRangeRedline* pRedl = GetDoc()->getIDocumentRedlineAccess().GetRedline(aPos, nullptr); if( pRedl ) { rContentAtPos.aFnd.pRedl = pRedl; - rContentAtPos.eContentAtPos = SwContentAtPos::SW_REDLINE; + rContentAtPos.eContentAtPos = IsAttrAtPos::Redline; rContentAtPos.pFndTextAttr = nullptr; bRet = true; @@ -1469,9 +1469,9 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } if( !bRet - && ( SwContentAtPos::SW_TABLEBOXFML & rContentAtPos.eContentAtPos + && ( IsAttrAtPos::TableBoxFml & rContentAtPos.eContentAtPos #ifdef DBG_UTIL - || SwContentAtPos::SW_TABLEBOXVALUE & rContentAtPos.eContentAtPos + || IsAttrAtPos::TableBoxValue & rContentAtPos.eContentAtPos #endif ) ) { @@ -1514,10 +1514,10 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, { // create from internal (for CORE) the external // (for UI) formula - rContentAtPos.eContentAtPos = SwContentAtPos::SW_TABLEBOXFML; + rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxFml; #ifdef DBG_UTIL if( RES_BOXATR_VALUE == pItem->Which() ) - rContentAtPos.eContentAtPos = SwContentAtPos::SW_TABLEBOXVALUE; + rContentAtPos.eContentAtPos = IsAttrAtPos::TableBoxValue; else #endif const_cast<SwTableBoxFormula*>(static_cast<const SwTableBoxFormula*>(pItem))->PtrToBoxNm( &pTableNd->GetTable() ); @@ -1550,7 +1550,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } #ifdef DBG_UTIL - if( !bRet && SwContentAtPos::SW_CURR_ATTRS & rContentAtPos.eContentAtPos ) + if( !bRet && IsAttrAtPos::CurrAttrs & rContentAtPos.eContentAtPos ) { const sal_Int32 n = aPos.nContent.GetIndex(); SfxItemSet aSet( GetDoc()->GetAttrPool(), POOLATTR_BEGIN, @@ -1627,7 +1627,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, } } bRet = true; - rContentAtPos.eContentAtPos = SwContentAtPos::SW_CURR_ATTRS; + rContentAtPos.eContentAtPos = IsAttrAtPos::CurrAttrs; } #endif } @@ -1635,7 +1635,7 @@ bool SwCursorShell::GetContentAtPos( const Point& rPt, if( !bRet ) { - rContentAtPos.eContentAtPos = SwContentAtPos::SW_NOTHING; + rContentAtPos.eContentAtPos = IsAttrAtPos::NONE; rContentAtPos.aFnd.pField = nullptr; } return bRet; @@ -1672,16 +1672,16 @@ bool SwContentAtPos::IsInProtectSect() const { switch( eContentAtPos ) { - case SW_FIELD: - case SW_CLICKFIELD: + case IsAttrAtPos::Field: + case IsAttrAtPos::ClickField: pNd = static_txtattr_cast<SwTextField const*>(pFndTextAttr)->GetpTextNode(); break; - case SW_FTN: + case IsAttrAtPos::Ftn: pNd = &static_cast<const SwTextFootnote*>(pFndTextAttr)->GetTextNode(); break; - case SW_INETATTR: + case IsAttrAtPos::InetAttr: pNd = static_txtattr_cast<SwTextINetFormat const*>(pFndTextAttr)->GetpTextNode(); break; @@ -1700,7 +1700,7 @@ bool SwContentAtPos::IsInRTLText()const { bool bRet = false; const SwTextNode* pNd = nullptr; - if (pFndTextAttr && (eContentAtPos == SW_FTN)) + if (pFndTextAttr && (eContentAtPos == IsAttrAtPos::Ftn)) { const SwTextFootnote* pTextFootnote = static_cast<const SwTextFootnote*>(pFndTextAttr); if(pTextFootnote->GetStartNode()) diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index c795569e8c84..094a8fe55861 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1987,8 +1987,7 @@ SwTextNode * SwFEShell::GetNumRuleNodeAtPos( const Point &rPt) { SwTextNode * pResult = nullptr; - SwContentAtPos aContentAtPos - (SwContentAtPos::SW_NUMLABEL); + SwContentAtPos aContentAtPos(IsAttrAtPos::NumLabel); if( GetContentAtPos(rPt, aContentAtPos) && aContentAtPos.aFnd.pNode) pResult = aContentAtPos.aFnd.pNode->GetTextNode(); @@ -2000,8 +1999,7 @@ bool SwFEShell::IsNumLabel( const Point &rPt, int nMaxOffset ) { bool bResult = false; - SwContentAtPos aContentAtPos - (SwContentAtPos::SW_NUMLABEL); + SwContentAtPos aContentAtPos(IsAttrAtPos::NumLabel); if( GetContentAtPos(rPt, aContentAtPos)) { diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index 8ddf1448c2bd..190afa612de4 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -453,7 +453,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo if( nSelectionType & nsSelectionType::SEL_TXT && !m_pWrtShell->HasMark() ) { - SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR ); + SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr ); Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY()); @@ -3115,7 +3115,7 @@ void SwTransferable::SetDataForDragAndDrop( const Point& rSttPos ) else if( nSelection & nsSelectionType::SEL_TXT && !m_pWrtShell->HasMark() ) { // is only one field - selected? - SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR ); + SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr ); Point aPos( SwEditWin::GetDDStartPosX(), SwEditWin::GetDDStartPosY()); if( m_pWrtShell->GetContentAtPos( aPos, aContentAtPos ) ) diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx index efdd971f5da2..5180568227cf 100644 --- a/sw/source/uibase/docvw/SidebarTxtControl.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx @@ -119,7 +119,7 @@ void SidebarTextControl::RequestHelp(const HelpEvent &rEvt) default: nResId = 0; } - SwContentAtPos aContentAtPos( SwContentAtPos::SW_REDLINE ); + SwContentAtPos aContentAtPos( IsAttrAtPos::Redline ); if ( nResId && mrDocView.GetWrtShell().GetContentAtPos( mrSidebarWin.GetAnchorPos(), aContentAtPos ) ) { diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx index f4d8f7c160df..fa6c3caf8370 100644 --- a/sw/source/uibase/docvw/edtdd.cxx +++ b/sw/source/uibase/docvw/edtdd.cxx @@ -103,7 +103,7 @@ void SwEditWin::StartDrag( sal_Int8 /*nAction*/, const Point& rPosPixel ) } else { - SwContentAtPos aSwContentAtPos( SwContentAtPos::SW_INETATTR ); + SwContentAtPos aSwContentAtPos( IsAttrAtPos::InetAttr ); bStart = rSh.GetContentAtPos( aDocPos, aSwContentAtPos ); } @@ -446,7 +446,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt ) SotExchangeDest::SWDOC_FREE_AREA == m_nDropDestination ) { CleanupDropUserMarker(); - SwContentAtPos aCont( SwContentAtPos::SW_CONTENT_CHECK ); + SwContentAtPos aCont( IsAttrAtPos::ContentCheck ); if(rSh.GetContentAtPos(aDocPt, aCont)) rSh.SwCursorShell::SetVisibleCursor( aDocPt ); } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index a5a350f936ce..1ac0c293d2ac 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -560,19 +560,19 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) else { // Even if we already have something, prefer URLs if possible. - SwContentAtPos aUrlPos(SwContentAtPos::SW_INETATTR); + SwContentAtPos aUrlPos(IsAttrAtPos::InetAttr); if (bCntAtPos || rSh.GetContentAtPos(rLPt, aUrlPos)) { SwContentAtPos aSwContentAtPos( - SwContentAtPos::SW_FIELD | - SwContentAtPos::SW_CLICKFIELD | - SwContentAtPos::SW_INETATTR | - SwContentAtPos::SW_FTN | - SwContentAtPos::SW_SMARTTAG ); + IsAttrAtPos::Field | + IsAttrAtPos::ClickField | + IsAttrAtPos::InetAttr | + IsAttrAtPos::Ftn | + IsAttrAtPos::SmartTag ); if( rSh.GetContentAtPos( rLPt, aSwContentAtPos) ) { // Is edit inline input field - if (SwContentAtPos::SW_FIELD == aSwContentAtPos.eContentAtPos) + if (IsAttrAtPos::Field == aSwContentAtPos.eContentAtPos) { if ( aSwContentAtPos.pFndTextAttr != nullptr && aSwContentAtPos.pFndTextAttr->Which() == RES_TXTATR_INPUTFIELD) @@ -584,11 +584,11 @@ void SwEditWin::UpdatePointer(const Point &rLPt, sal_uInt16 nModifier ) } else { - const bool bClickToFollow = SwContentAtPos::SW_INETATTR == aSwContentAtPos.eContentAtPos || - SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eContentAtPos; + const bool bClickToFollow = IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos || + IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos; if( !bClickToFollow || - (SwContentAtPos::SW_INETATTR == aSwContentAtPos.eContentAtPos && bExecHyperlinks) || - (SwContentAtPos::SW_SMARTTAG == aSwContentAtPos.eContentAtPos && bExecSmarttags) ) + (IsAttrAtPos::InetAttr == aSwContentAtPos.eContentAtPos && bExecHyperlinks) || + (IsAttrAtPos::SmartTag == aSwContentAtPos.eContentAtPos && bExecSmarttags) ) eStyle = PointerStyle::RefHand; } } @@ -2736,7 +2736,7 @@ void SwEditWin::RstMBDownFlags() */ static bool lcl_urlOverBackground(SwWrtShell& rSh, const Point& rDocPos) { - SwContentAtPos aSwContentAtPos(SwContentAtPos::SW_INETATTR); + SwContentAtPos aSwContentAtPos(IsAttrAtPos::InetAttr); SdrObject* pSelectableObj = rSh.GetObjAt(rDocPos); return rSh.GetContentAtPos(rDocPos, aSwContentAtPos) && pSelectableObj->GetLayer() == rSh.GetDoc()->getIDocumentDrawModelAccess().GetHellId(); @@ -3598,8 +3598,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) if( bExecHyperlinks ) { SwContentAtPos aContentAtPos( - SwContentAtPos::SW_FTN | - SwContentAtPos::SW_INETATTR ); + IsAttrAtPos::Ftn | + IsAttrAtPos::InetAttr ); if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) ) { @@ -3625,8 +3625,8 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) default: if( !rSh.IsViewLocked() ) { - SwContentAtPos aContentAtPos( SwContentAtPos::SW_CLICKFIELD | - SwContentAtPos::SW_INETATTR ); + SwContentAtPos aContentAtPos( IsAttrAtPos::ClickField | + IsAttrAtPos::InetAttr ); if( rSh.GetContentAtPos( aDocPos, aContentAtPos ) && !rSh.IsReadOnlyAvailable() && aContentAtPos.IsInProtectSect() ) @@ -3640,7 +3640,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) rSh.ClearGCAttr(); } - SwContentAtPos aFieldAtPos(SwContentAtPos::SW_FIELD); + SwContentAtPos aFieldAtPos(IsAttrAtPos::Field); bool bEditableFieldClicked = false; // Are we clicking on a field? @@ -3717,7 +3717,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) && static_cast< sal_uInt8 >(rMEvt.GetClicks() % 4) == 1 && !rSh.TestCurrPam( aDocPos ) ) { - SwContentAtPos aFieldAtPos(SwContentAtPos::SW_FIELD); + SwContentAtPos aFieldAtPos(IsAttrAtPos::Field); // Are we clicking on a field? if (g_bValidCursorPos @@ -4163,9 +4163,9 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) break; } // change ui if mouse is over SwPostItField - // TODO: do the same thing for redlines SW_REDLINE + // TODO: do the same thing for redlines IsAttrAtPos::Redline SwRect aFieldRect; - SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD); + SwContentAtPos aContentAtPos( IsAttrAtPos::Field); if( rSh.GetContentAtPos( aDocPt, aContentAtPos, false, &aFieldRect ) ) { const SwField* pField = aContentAtPos.aFnd.pField; @@ -4191,7 +4191,7 @@ void SwEditWin::MouseMove(const MouseEvent& _rMEvt) const SwFrameFormat* pFormat = nullptr; const SwFormatINetFormat* pINet = nullptr; - SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR ); + SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr ); if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) ) pINet = static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr); @@ -4556,7 +4556,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) } else { - SwContentAtPos aFieldAtPos ( SwContentAtPos::SW_FIELD ); + SwContentAtPos aFieldAtPos ( IsAttrAtPos::Field ); if ( !rSh.IsInSelect() && rSh.TestCurrPam( aDocPt ) && !rSh.GetContentAtPos( aDocPt, aFieldAtPos ) ) { @@ -4598,15 +4598,15 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) if(m_pApplyTempl) bExecHyperlinks = false; - SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD | - SwContentAtPos::SW_INETATTR | - SwContentAtPos::SW_SMARTTAG | SwContentAtPos::SW_FORMCTRL); + SwContentAtPos aContentAtPos( IsAttrAtPos::Field | + IsAttrAtPos::InetAttr | + IsAttrAtPos::SmartTag | IsAttrAtPos::FormControl); if( rSh.GetContentAtPos( aDocPt, aContentAtPos ) ) { // Do it again if we're not on a field/hyperlink to update the cursor accordingly - if ( SwContentAtPos::SW_FIELD != aContentAtPos.eContentAtPos - && SwContentAtPos::SW_INETATTR != aContentAtPos.eContentAtPos ) + if ( IsAttrAtPos::Field != aContentAtPos.eContentAtPos + && IsAttrAtPos::InetAttr != aContentAtPos.eContentAtPos ) rSh.GetContentAtPos( aDocPt, aContentAtPos, true ); bool bViewLocked = rSh.IsViewLocked(); @@ -4616,7 +4616,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) ReleaseMouse(); - if( SwContentAtPos::SW_FIELD == aContentAtPos.eContentAtPos ) + if( IsAttrAtPos::Field == aContentAtPos.eContentAtPos ) { bool bAddMode(false); // AdditionalMode if applicable @@ -4655,13 +4655,13 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) rSh.LeaveAddMode(); } } - else if ( SwContentAtPos::SW_SMARTTAG == aContentAtPos.eContentAtPos ) + else if ( IsAttrAtPos::SmartTag == aContentAtPos.eContentAtPos ) { // execute smarttag menu if ( bExecSmarttags && SwSmartTagMgr::Get().IsSmartTagsEnabled() ) m_rView.ExecSmartTagPopup( aDocPt ); } - else if ( SwContentAtPos::SW_FORMCTRL == aContentAtPos.eContentAtPos ) + else if ( IsAttrAtPos::FormControl == aContentAtPos.eContentAtPos ) { OSL_ENSURE( aContentAtPos.aFnd.pFieldmark != nullptr, "where is my field ptr???"); if ( aContentAtPos.aFnd.pFieldmark != nullptr) @@ -4682,7 +4682,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) } } } - else if ( SwContentAtPos::SW_INETATTR == aContentAtPos.eContentAtPos ) + else if ( IsAttrAtPos::InetAttr == aContentAtPos.eContentAtPos ) { if ( bExecHyperlinks && aContentAtPos.aFnd.pAttr ) rSh.ClickToINetAttr( *static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr), nFilter ); @@ -4693,7 +4693,7 @@ void SwEditWin::MouseButtonUp(const MouseEvent& rMEvt) } else { - aContentAtPos = SwContentAtPos( SwContentAtPos::SW_FTN ); + aContentAtPos = SwContentAtPos( IsAttrAtPos::Ftn ); if( !rSh.GetContentAtPos( aDocPt, aContentAtPos, true ) && bExecHyperlinks ) { SdrViewEvent aVEvt; diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx index 14e031b610c8..5d173185bc04 100644 --- a/sw/source/uibase/docvw/edtwin2.cxx +++ b/sw/source/uibase/docvw/edtwin2.cxx @@ -129,42 +129,42 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) if( bContinue && bQuickBalloon) { SwRect aFieldRect; - SwContentAtPos aContentAtPos( SwContentAtPos::SW_FIELD | - SwContentAtPos::SW_INETATTR | - SwContentAtPos::SW_FTN | - SwContentAtPos::SW_REDLINE | - SwContentAtPos::SW_TOXMARK | - SwContentAtPos::SW_REFMARK | - SwContentAtPos::SW_SMARTTAG | + SwContentAtPos aContentAtPos( IsAttrAtPos::Field | + IsAttrAtPos::InetAttr | + IsAttrAtPos::Ftn | + IsAttrAtPos::Redline | + IsAttrAtPos::ToxMark | + IsAttrAtPos::RefMark | + IsAttrAtPos::SmartTag | #ifdef DBG_UTIL - SwContentAtPos::SW_TABLEBOXVALUE | - ( bBalloon ? SwContentAtPos::SW_CURR_ATTRS : 0) | + IsAttrAtPos::TableBoxValue | + ( bBalloon ? IsAttrAtPos::CurrAttrs : IsAttrAtPos::NONE) | #endif - SwContentAtPos::SW_TABLEBOXFML ); + IsAttrAtPos::TableBoxFml ); if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) ) { QuickHelpFlags nStyle = QuickHelpFlags::NONE; // style of quick help switch( aContentAtPos.eContentAtPos ) { - case SwContentAtPos::SW_TABLEBOXFML: + case IsAttrAtPos::TableBoxFml: sText = "= "; sText += static_cast<const SwTableBoxFormula*>(aContentAtPos.aFnd.pAttr)->GetFormula(); break; #ifdef DBG_UTIL - case SwContentAtPos::SW_TABLEBOXVALUE: + case IsAttrAtPos::TableBoxValue: { sText = OStringToOUString(OString::number( static_cast<const SwTableBoxValue*>(aContentAtPos.aFnd.pAttr)->GetValue()), osl_getThreadTextEncoding()); } break; - case SwContentAtPos::SW_CURR_ATTRS: + case IsAttrAtPos::CurrAttrs: sText = aContentAtPos.sStr; break; #endif - case SwContentAtPos::SW_INETATTR: + case IsAttrAtPos::InetAttr: { sText = static_cast<const SfxStringItem*>(aContentAtPos.aFnd.pAttr)->GetValue(); sText = URIHelper::removePassword( sText, @@ -230,7 +230,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } break; } - case SwContentAtPos::SW_SMARTTAG: + case IsAttrAtPos::SmartTag: { vcl::KeyCode aCode( KEY_SPACE ); vcl::KeyCode aModifiedCode( KEY_SPACE, KEY_MOD1 ); @@ -241,7 +241,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } break; - case SwContentAtPos::SW_FTN: + case IsAttrAtPos::Ftn: if( aContentAtPos.pFndTextAttr && aContentAtPos.aFnd.pAttr ) { const SwFormatFootnote* pFootnote = static_cast<const SwFormatFootnote*>(aContentAtPos.aFnd.pAttr); @@ -255,11 +255,11 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } break; - case SwContentAtPos::SW_REDLINE: + case IsAttrAtPos::Redline: sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon); break; - case SwContentAtPos::SW_TOXMARK: + case IsAttrAtPos::ToxMark: sText = aContentAtPos.sStr; if( !sText.isEmpty() && aContentAtPos.pFndTextAttr ) { @@ -272,7 +272,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) } } break; - case SwContentAtPos::SW_REFMARK: + case IsAttrAtPos::RefMark: if(aContentAtPos.aFnd.pAttr) { sText = SW_RESSTR(STR_CONTENT_TYPE_SINGLE_REFERENCE); @@ -356,7 +356,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt) if( sText.isEmpty() ) { - aContentAtPos.eContentAtPos = SwContentAtPos::SW_REDLINE; + aContentAtPos.eContentAtPos = IsAttrAtPos::Redline; if( rSh.GetContentAtPos( aPos, aContentAtPos, false, &aFieldRect ) ) sText = lcl_GetRedlineHelp(*aContentAtPos.aFnd.pRedl, bBalloon); } diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx index 3e48e067a8f8..3f494bdb4b39 100644 --- a/sw/source/uibase/docvw/romenu.cxx +++ b/sw/source/uibase/docvw/romenu.cxx @@ -97,7 +97,7 @@ SwReadOnlyPopup::SwReadOnlyPopup( const Point &rDPos, SwView &rV ) : rSh.IsURLGrfAtPos( rDocPos, &sURL, &sTargetFrameName, &sDescription ); if ( sURL.isEmpty() ) { - SwContentAtPos aContentAtPos( SwContentAtPos::SW_INETATTR ); + SwContentAtPos aContentAtPos( IsAttrAtPos::InetAttr ); if( rSh.GetContentAtPos( rDocPos, aContentAtPos)) { const SwFormatINetFormat &rIItem = *static_cast<const SwFormatINetFormat*>(aContentAtPos.aFnd.pAttr); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index 0c8e7dff8f65..477ce1f18899 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -721,7 +721,7 @@ IMPL_LINK( SwView, ScrollHdl, ScrollBar *, p, void ) aRect.Bottom() = aRect.Top(); OUString sPageStr( GetPageStr( nPhNum, nVirtNum, sDisplay )); - SwContentAtPos aCnt( SwContentAtPos::SW_OUTLINE ); + SwContentAtPos aCnt( IsAttrAtPos::Outline ); bool bSuccess = m_pWrtShell->GetContentAtPos(aPos, aCnt); if (bSuccess && !aCnt.sStr.isEmpty()) { |