diff options
33 files changed, 208 insertions, 196 deletions
diff --git a/sw/inc/IDocumentRedlineAccess.hxx b/sw/inc/IDocumentRedlineAccess.hxx index 757394ded765..71650325042b 100644 --- a/sw/inc/IDocumentRedlineAccess.hxx +++ b/sw/inc/IDocumentRedlineAccess.hxx @@ -28,6 +28,8 @@ #include <com/sun/star/uno/Sequence.hxx> #include <o3tl/typed_flags_set.hxx> +#include <docary.hxx> + class SwRangeRedline; class SwTableRowRedline; class SwTableCellRedline; @@ -163,7 +165,7 @@ public: /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType) = 0; - virtual sal_uInt16 GetRedlinePos( + virtual SwRedlineTable::size_type GetRedlinePos( /*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const = 0; @@ -171,17 +173,17 @@ public: virtual const SwRangeRedline* GetRedline( /*[in]*/const SwPosition& rPos, - /*[in]*/sal_uInt16* pFndPos) const = 0; + /*[in]*/SwRedlineTable::size_type* pFndPos) const = 0; virtual bool IsRedlineMove() const = 0; virtual void SetRedlineMove(/*[in]*/bool bFlag) = 0; - virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0; + virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; - virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) = 0; + virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) = 0; virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) = 0; diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 2b03f7bbb734..ef2e9539859c 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -28,6 +28,7 @@ #include <IShellCursorSupplier.hxx> #include "swdllapi.h" +#include <docary.hxx> #include <swtypes.hxx> #include <viewsh.hxx> #include <calbck.hxx> @@ -267,7 +268,7 @@ private: typedef bool (SwCursor:: *FNCursor)(); SAL_DLLPRIVATE bool CallCursorFN( FNCursor ); - SAL_DLLPRIVATE const SwRangeRedline* GotoRedline_( sal_uInt16 nArrPos, bool bSelect ); + SAL_DLLPRIVATE const SwRangeRedline* GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ); protected: @@ -797,7 +798,7 @@ public: const SwRangeRedline* SelNextRedline(); const SwRangeRedline* SelPrevRedline(); - const SwRangeRedline* GotoRedline( sal_uInt16 nArrPos, bool bSelect ); + const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ); // is cursor or the point in/over a vertical formatted text? bool IsInVerticalText( const Point* pPt = nullptr ) const; diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index 2de106f9fc1e..dec10c8e23d9 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -318,35 +318,34 @@ class SwRedlineTable public: typedef o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTable, o3tl::find_partialorder_ptrequals> vector_type; - typedef sal_uInt16 size_type; - //TOOD: should be vector_type::size_type, but then all the uses of - // sal_uInt16 in this class that represent positions in maVector need to - // be changed, too + typedef vector_type::size_type size_type; + static SAL_CONSTEXPR size_type const npos = USHRT_MAX; + //TODO: std::numeric_limits<size_type>::max() private: vector_type maVector; public: ~SwRedlineTable(); bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast<SwRangeRedline* const>(p)) != maVector.end(); } - sal_uInt16 GetPos(const SwRangeRedline* p) const; + size_type GetPos(const SwRangeRedline* p) const; bool Insert( SwRangeRedline* p ); - bool Insert( SwRangeRedline* p, sal_uInt16& rInsPos ); - bool InsertWithValidRanges( SwRangeRedline* p, sal_uInt16* pInsPos = nullptr ); + bool Insert( SwRangeRedline* p, size_type& rInsPos ); + bool InsertWithValidRanges( SwRangeRedline* p, size_type* pInsPos = nullptr ); - void Remove( sal_uInt16 nPos ); + void Remove( size_type nPos ); bool Remove( const SwRangeRedline* p ); - void DeleteAndDestroy( sal_uInt16 nPos, sal_uInt16 nLen = 1 ); + void DeleteAndDestroy( size_type nPos, size_type nLen = 1 ); void DeleteAndDestroyAll(); void dumpAsXml(struct _xmlTextWriter* pWriter) const; - sal_uInt16 FindNextOfSeqNo( sal_uInt16 nSttPos ) const; - sal_uInt16 FindPrevOfSeqNo( sal_uInt16 nSttPos ) const; + size_type FindNextOfSeqNo( size_type nSttPos ) const; + size_type FindPrevOfSeqNo( size_type nSttPos ) const; /** Search next or previous Redline with the same Seq. No. Search can be restricted via Lookahead. Using 0 makes search the whole array. */ - sal_uInt16 FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos ) const; - sal_uInt16 FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos ) const; + size_type FindNextSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const; + size_type FindPrevSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const; /** Find the redline at the given position. @@ -355,7 +354,7 @@ public: redline (or the next redline after the given position if not found) @param next true: redline starts at position and ends after, false: redline starts before position and ends at or after */ - const SwRangeRedline* FindAtPosition( const SwPosition& startPosition, sal_uInt16& tableIndex, bool next = true ) const; + const SwRangeRedline* FindAtPosition( const SwPosition& startPosition, size_type& tableIndex, bool next = true ) const; bool empty() const { return maVector.empty(); } size_type size() const { return maVector.size(); } diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index be04c6a52033..4fede714eed3 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -889,16 +889,16 @@ public: RedlineFlags GetRedlineFlags() const; void SetRedlineFlags( RedlineFlags eMode ); bool IsRedlineOn() const; - sal_uInt16 GetRedlineCount() const; - const SwRangeRedline& GetRedline( sal_uInt16 nPos ) const; - bool AcceptRedline( sal_uInt16 nPos ); - bool RejectRedline( sal_uInt16 nPos ); + SwRedlineTable::size_type GetRedlineCount() const; + const SwRangeRedline& GetRedline( SwRedlineTable::size_type nPos ) const; + bool AcceptRedline( SwRedlineTable::size_type nPos ); + bool RejectRedline( SwRedlineTable::size_type nPos ); bool AcceptRedlinesInSelection(); bool RejectRedlinesInSelection(); /** Search Redline for this Data and @return position in array. - If not found, return USHRT_MAX. */ - sal_uInt16 FindRedlineOfData( const SwRedlineData& ) const; + If not found, return SwRedlineTable::npos. */ + SwRedlineTable::size_type FindRedlineOfData( const SwRedlineData& ) const; /// Set comment to Redline at position. bool SetRedlineComment( const OUString& rS ); diff --git a/sw/inc/unoredlines.hxx b/sw/inc/unoredlines.hxx index 420e81cab4de..9fe86311ca38 100644 --- a/sw/inc/unoredlines.hxx +++ b/sw/inc/unoredlines.hxx @@ -19,6 +19,9 @@ #ifndef INCLUDED_SW_INC_UNOREDLINES_HXX #define INCLUDED_SW_INC_UNOREDLINES_HXX +#include <sal/config.h> + +#include <docary.hxx> #include <unocoll.hxx> #include <unobaseclass.hxx> #include <com/sun/star/container/XEnumerationAccess.hpp> @@ -69,7 +72,7 @@ class SwXRedlineEnumeration , public SwClient { SwDoc* pDoc; - sal_uInt16 nCurrentIndex; + SwRedlineTable::size_type nCurrentIndex; protected: virtual ~SwXRedlineEnumeration() override; public: diff --git a/sw/source/core/access/parachangetrackinginfo.cxx b/sw/source/core/access/parachangetrackinginfo.cxx index e59a54fc1d20..0b2f8888b85f 100644 --- a/sw/source/core/access/parachangetrackinginfo.cxx +++ b/sw/source/core/access/parachangetrackinginfo.cxx @@ -56,9 +56,9 @@ namespace { return; } - const sal_uInt16 nIdxOfFirstRedlineForTextNode = + const SwRedlineTable::size_type nIdxOfFirstRedlineForTextNode = rIDocChangeTrack.GetRedlinePos( rTextNode, USHRT_MAX ); - if ( nIdxOfFirstRedlineForTextNode == USHRT_MAX ) + if ( nIdxOfFirstRedlineForTextNode == SwRedlineTable::npos ) { // nothing to do --> empty change track text markup lists. return; @@ -73,8 +73,8 @@ namespace { // iteration over the redlines which overlap with the text node. const SwRedlineTable& rRedlineTable = rIDocChangeTrack.GetRedlineTable(); - const sal_uInt16 nRedlineCount( rRedlineTable.size() ); - for ( sal_uInt16 nActRedline = nIdxOfFirstRedlineForTextNode; + const SwRedlineTable::size_type nRedlineCount( rRedlineTable.size() ); + for ( SwRedlineTable::size_type nActRedline = nIdxOfFirstRedlineForTextNode; nActRedline < nRedlineCount; ++nActRedline) { diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index a9858e192947..b0de2a06ce62 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -2009,7 +2009,7 @@ const SwRangeRedline* SwCursorShell::SelPrevRedline() return pFnd; } -const SwRangeRedline* SwCursorShell::GotoRedline_( sal_uInt16 nArrPos, bool bSelect ) +const SwRangeRedline* SwCursorShell::GotoRedline_( SwRedlineTable::size_type nArrPos, bool bSelect ) { const SwRangeRedline* pFnd = nullptr; SwCallLink aLk( *this ); // watch Cursor-Moves @@ -2077,7 +2077,7 @@ const SwRangeRedline* SwCursorShell::GotoRedline_( sal_uInt16 nArrPos, bool bSel return pFnd; } -const SwRangeRedline* SwCursorShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect ) +const SwRangeRedline* SwCursorShell::GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ) { const SwRangeRedline* pFnd = nullptr; if( !IsTableMode() ) @@ -2091,7 +2091,7 @@ const SwRangeRedline* SwCursorShell::GotoRedline( sal_uInt16 nArrPos, bool bSele { bool bCheck = false; int nLoopCnt = 2; - sal_uInt16 nArrSavPos = nArrPos; + SwRedlineTable::size_type nArrSavPos = nArrPos; do { pTmp = GotoRedline_( nArrPos, true ); @@ -2160,11 +2160,11 @@ const SwRangeRedline* SwCursorShell::GotoRedline( sal_uInt16 nArrPos, bool bSele } } - sal_uInt16 nFndPos = 2 == nLoopCnt + SwRedlineTable::size_type nFndPos = 2 == nLoopCnt ? rTable.FindNextOfSeqNo( nArrPos ) : rTable.FindPrevOfSeqNo( nArrPos ); - if( USHRT_MAX != nFndPos || - ( 0 != ( --nLoopCnt ) && USHRT_MAX != ( + if( SwRedlineTable::npos != nFndPos || + ( 0 != ( --nLoopCnt ) && SwRedlineTable::npos != ( nFndPos = rTable.FindPrevOfSeqNo( nArrSavPos ))) ) { if( pTmp ) diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 931a6dec1fe1..c3a4c3816b91 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1431,7 +1431,7 @@ static OUString lcl_MaskDeletedRedlines( const SwTextNode* pTextNd ) const bool bShowChg = IDocumentRedlineAccess::IsShowChanges( rDoc.getIDocumentRedlineAccess().GetRedlineFlags() ); if ( bShowChg ) { - sal_uInt16 nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( *pTextNd, USHRT_MAX ); + SwRedlineTable::size_type nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( *pTextNd, USHRT_MAX ); for ( ; nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); nAct++ ) { const SwRangeRedline* pRed = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 1e7ce9ddca56..06d61e8076cd 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -335,7 +335,7 @@ namespace sal_uLong nDelCount; SwNodeIndex aCorrIdx(InitDelCount(rPam, nDelCount)); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; pSrcDoc->getIDocumentRedlineAccess().GetRedline( *pStt, &n ); for( ; n < rTable.size(); ++n ) { @@ -663,7 +663,7 @@ namespace const SwPosition* pEnd = aPam.End(); // get first relevant redline - sal_uInt16 nCurrentRedline; + SwRedlineTable::size_type nCurrentRedline; pDoc->getIDocumentRedlineAccess().GetRedline( *pStart, &nCurrentRedline ); if( nCurrentRedline > 0) nCurrentRedline--; @@ -738,7 +738,7 @@ namespace void lcl_SaveRedlines(const SwNodeRange& rRg, SaveRedlines_t& rArr) { SwDoc* pDoc = rRg.aStart.GetNode().GetDoc(); - sal_uInt16 nRedlPos; + SwRedlineTable::size_type nRedlPos; SwPosition aSrchPos( rRg.aStart ); aSrchPos.nNode--; aSrchPos.nContent.Assign( aSrchPos.nNode.GetNode().GetContentNode(), 0 ); if( pDoc->getIDocumentRedlineAccess().GetRedline( aSrchPos, &nRedlPos ) && nRedlPos ) @@ -2222,8 +2222,8 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod // Find all RedLines that end at the InsPos. // These have to be moved back to the "old" position after the Move. - sal_uInt16 nRedlPos = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( rPos.GetNode(), USHRT_MAX ); - if( USHRT_MAX != nRedlPos ) + SwRedlineTable::size_type nRedlPos = m_rDoc.getIDocumentRedlineAccess().GetRedlinePos( rPos.GetNode(), USHRT_MAX ); + if( SwRedlineTable::npos != nRedlPos ) { const SwPosition *pRStt, *pREnd; do { diff --git a/sw/source/core/doc/DocumentRedlineManager.cxx b/sw/source/core/doc/DocumentRedlineManager.cxx index 6db6b797dc35..2069c3476132 100644 --- a/sw/source/core/doc/DocumentRedlineManager.cxx +++ b/sw/source/core/doc/DocumentRedlineManager.cxx @@ -121,7 +121,7 @@ namespace rPos1.nContent.GetIndex() == pCNd->Len(); } - bool lcl_AcceptRedline( SwRedlineTable& rArr, sal_uInt16& rPos, + bool lcl_AcceptRedline( SwRedlineTable& rArr, SwRedlineTable::size_type& rPos, bool bCallDelete, const SwPosition* pSttRng = nullptr, const SwPosition* pEndRng = nullptr ) @@ -284,7 +284,7 @@ namespace return bRet; } - bool lcl_RejectRedline( SwRedlineTable& rArr, sal_uInt16& rPos, + bool lcl_RejectRedline( SwRedlineTable& rArr, SwRedlineTable::size_type& rPos, bool bCallDelete, const SwPosition* pSttRng = nullptr, const SwPosition* pEndRng = nullptr ) @@ -488,7 +488,7 @@ namespace return bRet; } - typedef bool (*Fn_AcceptReject)( SwRedlineTable& rArr, sal_uInt16& rPos, + typedef bool (*Fn_AcceptReject)( SwRedlineTable& rArr, SwRedlineTable::size_type& rPos, bool bCallDelete, const SwPosition* pSttRng, const SwPosition* pEndRng); @@ -498,7 +498,7 @@ namespace SwRedlineTable& rArr, bool bCallDelete, const SwPaM& rPam) { - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; int nCount = 0; const SwPosition* pStt = rPam.Start(), @@ -794,7 +794,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall return false; } bool bCompress = false; - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; // look up the first Redline for the starting position if( !GetRedline( *pStt, &n ) && n ) --n; @@ -835,7 +835,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall ( POS_COLLIDE_START == eCmpPos ) || ( POS_OVERLAP_BEHIND == eCmpPos ) ) && pRedl->CanCombine( *pNewRedl ) && - ( n+1 >= (sal_uInt16)mpRedlineTable->size() || + ( n+1 >= mpRedlineTable->size() || ( *(*mpRedlineTable)[ n+1 ]->Start() >= *pEnd && *(*mpRedlineTable)[ n+1 ]->Start() != *pREnd ) ) ) { @@ -1144,7 +1144,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall // delete current (below), and restart process with // previous - sal_uInt16 nToBeDeleted = n; + SwRedlineTable::size_type nToBeDeleted = n; bDec = true; if( *(pNewRedl->Start()) <= *pREnd ) @@ -1623,7 +1623,7 @@ bool DocumentRedlineManager::AppendRedline( SwRangeRedline* pNewRedl, bool bCall case POS_COLLIDE_START: if( pRedl->IsOwnRedline( *pNewRedl ) && pRedl->CanCombine( *pNewRedl ) && - n+1 < (sal_uInt16)mpRedlineTable->size() && + n+1 < mpRedlineTable->size() && *(*mpRedlineTable)[ n+1 ]->Start() < *pEnd ) { // If that's the case we can merge it, meaning @@ -1787,7 +1787,7 @@ void DocumentRedlineManager::CompressRedlines() pFnc = &SwRangeRedline::Hide; // Try to merge identical ones - for( size_t n = 1; n < mpRedlineTable->size(); ++n ) + for( SwRedlineTable::size_type n = 1; n < mpRedlineTable->size(); ++n ) { SwRangeRedline* pPrev = (*mpRedlineTable)[ n-1 ], * pCur = (*mpRedlineTable)[ n ]; @@ -1803,7 +1803,7 @@ void DocumentRedlineManager::CompressRedlines() !pCurEnd->nNode.GetNode().StartOfSectionNode()->IsTableNode() ) { // we then can merge them - size_t nPrevIndex = n-1; + SwRedlineTable::size_type nPrevIndex = n-1; pPrev->Show(0, nPrevIndex); pCur->Show(0, n); @@ -1822,7 +1822,7 @@ void DocumentRedlineManager::CompressRedlines() bool DocumentRedlineManager::SplitRedline( const SwPaM& rRange ) { bool bChg = false; - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; const SwPosition* pStt = rRange.Start(); const SwPosition* pEnd = rRange.End(); GetRedline( *pStt, &n ); @@ -1904,7 +1904,7 @@ bool DocumentRedlineManager::DeleteRedline( const SwPaM& rRange, bool bSaveInUnd const SwPosition* pStt = rRange.Start(), * pEnd = pStt == rRange.GetPoint() ? rRange.GetMark() : rRange.GetPoint(); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; GetRedline( *pStt, &n ); for( ; n < mpRedlineTable->size() ; ++n ) { @@ -2005,10 +2005,10 @@ bool DocumentRedlineManager::DeleteRedline( const SwStartNode& rNode, bool bSave return DeleteRedline(aTemp, bSaveInUndo, nDelType); } -sal_uInt16 DocumentRedlineManager::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const +SwRedlineTable::size_type DocumentRedlineManager::GetRedlinePos( const SwNode& rNd, sal_uInt16 nType ) const { const sal_uLong nNdIdx = rNd.GetIndex(); - for( size_t n = 0; n < mpRedlineTable->size() ; ++n ) + for( SwRedlineTable::size_type n = 0; n < mpRedlineTable->size() ; ++n ) { const SwRangeRedline* pTmp = (*mpRedlineTable)[ n ]; sal_uLong nPt = pTmp->GetPoint()->nNode.GetIndex(), @@ -2022,15 +2022,15 @@ sal_uInt16 DocumentRedlineManager::GetRedlinePos( const SwNode& rNd, sal_uInt16 if( nMk > nNdIdx ) break; } - return USHRT_MAX; + return SwRedlineTable::npos; // #TODO - add 'SwExtraRedlineTable' also ? } const SwRangeRedline* DocumentRedlineManager::GetRedline( const SwPosition& rPos, - sal_uInt16* pFndPos ) const + SwRedlineTable::size_type* pFndPos ) const { - sal_uInt16 nO = mpRedlineTable->size(), nM, nU = 0; + SwRedlineTable::size_type nO = mpRedlineTable->size(), nM, nU = 0; if( nO > 0 ) { nO--; @@ -2097,7 +2097,7 @@ const SwRangeRedline* DocumentRedlineManager::GetRedline( const SwPosition& rPos // #TODO - add 'SwExtraRedlineTable' also ? } -bool DocumentRedlineManager::AcceptRedline( sal_uInt16 nPos, bool bCallDelete ) +bool DocumentRedlineManager::AcceptRedline( SwRedlineTable::size_type nPos, bool bCallDelete ) { bool bRet = false; @@ -2132,13 +2132,13 @@ bool DocumentRedlineManager::AcceptRedline( sal_uInt16 nPos, bool bCallDelete ) if( nSeqNo ) { - if( USHRT_MAX == nPos ) + if( SwRedlineTable::npos == nPos ) nPos = 0; - sal_uInt16 nFndPos = 2 == nLoopCnt + SwRedlineTable::size_type nFndPos = 2 == nLoopCnt ? mpRedlineTable->FindNextSeqNo( nSeqNo, nPos ) : mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ); - if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) && - USHRT_MAX != ( nFndPos = + if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && + SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; else @@ -2211,7 +2211,7 @@ bool DocumentRedlineManager::AcceptRedline( const SwPaM& rPam, bool bCallDelete // #TODO - add 'SwExtraRedlineTable' also ? } -bool DocumentRedlineManager::RejectRedline( sal_uInt16 nPos, bool bCallDelete ) +bool DocumentRedlineManager::RejectRedline( SwRedlineTable::size_type nPos, bool bCallDelete ) { bool bRet = false; @@ -2246,13 +2246,13 @@ bool DocumentRedlineManager::RejectRedline( sal_uInt16 nPos, bool bCallDelete ) if( nSeqNo ) { - if( USHRT_MAX == nPos ) + if( SwRedlineTable::npos == nPos ) nPos = 0; - sal_uInt16 nFndPos = 2 == nLoopCnt + SwRedlineTable::size_type nFndPos = 2 == nLoopCnt ? mpRedlineTable->FindNextSeqNo( nSeqNo, nPos ) : mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ); - if( USHRT_MAX != nFndPos || ( 0 != ( --nLoopCnt ) && - USHRT_MAX != ( nFndPos = + if( SwRedlineTable::npos != nFndPos || ( 0 != ( --nLoopCnt ) && + SwRedlineTable::npos != ( nFndPos = mpRedlineTable->FindPrevSeqNo( nSeqNo, nPos ))) ) pTmp = (*mpRedlineTable)[ nPos = nFndPos ]; else @@ -2337,7 +2337,7 @@ const SwRangeRedline* DocumentRedlineManager::SelNextRedline( SwPaM& rPam ) cons // If the starting position points to the last valid ContentNode, // we take the next Redline in any case. - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; const SwRangeRedline* pFnd = GetRedlineTable().FindAtPosition( rSttPos, n ); if( pFnd ) { @@ -2456,7 +2456,7 @@ const SwRangeRedline* DocumentRedlineManager::SelPrevRedline( SwPaM& rPam ) cons // If the starting position points to the last valid ContentNode, // we take the previous Redline in any case. - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; const SwRangeRedline* pFnd = GetRedlineTable().FindAtPosition( rSttPos, n, false ); if( pFnd ) { @@ -2573,7 +2573,7 @@ bool DocumentRedlineManager::SetRedlineComment( const SwPaM& rPaM, const OUStrin const SwPosition* pStt = rPaM.Start(), * pEnd = pStt == rPaM.GetPoint() ? rPaM.GetMark() : rPaM.GetPoint(); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; if( GetRedlineTable().FindAtPosition( *pStt, n ) ) { for( ; n < mpRedlineTable->size(); ++n ) diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 5adbb5fbbbaf..74d4452d7712 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1950,7 +1950,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) // If there already is a deleted or inserted one at the same position, we have to split it! SwPosition* pDStt = pDestRedl->GetMark(), * pDEnd = pDestRedl->GetPoint(); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; // find the first redline for StartPos if( !pDoc->getIDocumentRedlineAccess().GetRedline( *pDStt, &n ) && n ) @@ -2008,7 +2008,7 @@ sal_uInt16 SaveMergeRedline::InsertRedline(SwPaM* pLastDestRedline) *pDStt = *pREnd; // we should start over now - n = USHRT_MAX; + n = SwRedlineTable::npos; } break; diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index bd46b4a0ca3b..c6934905b32f 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -246,7 +246,7 @@ SaveRedlEndPosForRestore::SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx, SwDoc* pDest = rNd.GetDoc(); if( !pDest->getIDocumentRedlineAccess().GetRedlineTable().empty() ) { - sal_uInt16 nFndPos; + SwRedlineTable::size_type nFndPos; const SwPosition* pEnd; SwPosition aSrcPos( rInsIdx, SwIndex( rNd.GetContentNode(), nCnt )); pDest->getIDocumentRedlineAccess().GetRedline( aSrcPos, &nFndPos ); diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index deed273a105a..04405d349504 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1796,8 +1796,8 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) // Test for Redlining - Can the Selection be moved at all, actually? if( !getIDocumentRedlineAccess().IsIgnoreRedline() ) { - sal_uInt16 nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); - if( USHRT_MAX != nRedlPos ) + SwRedlineTable::size_type nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_DELETE ); + if( SwRedlineTable::npos != nRedlPos ) { SwPosition aStPos( *pStt ), aEndPos( *pEnd ); aStPos.nContent = 0; @@ -1853,8 +1853,8 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) if( getIDocumentRedlineAccess().IsRedlineOn() ) { // If the range is completely in the own Redline, we can move it! - sal_uInt16 nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); - if( USHRT_MAX != nRedlPos ) + SwRedlineTable::size_type nRedlPos = getIDocumentRedlineAccess().GetRedlinePos( pStt->nNode.GetNode(), nsRedlineType_t::REDLINE_INSERT ); + if( SwRedlineTable::npos != nRedlPos ) { SwRangeRedline* pTmp = getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos ]; const SwPosition *pRStt = pTmp->Start(), *pREnd = pTmp->End(); @@ -1870,7 +1870,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) : !pREnd->nContent.GetIndex() )) ) { pOwnRedl = pTmp; - if( nRedlPos + 1 < (sal_uInt16)getIDocumentRedlineAccess().GetRedlineTable().size() ) + if( nRedlPos + 1 < getIDocumentRedlineAccess().GetRedlineTable().size() ) { pTmp = getIDocumentRedlineAccess().GetRedlineTable()[ nRedlPos+1 ]; if( *pTmp->Start() == *pREnd ) diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 95725bc8351f..13421f58e3c2 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -301,7 +301,7 @@ bool SwExtraRedlineTable::DeleteTableCellRedline( SwDoc* pDoc, const SwTableBox& } /// Emits LOK notification about one addition / removal of a redline item. -static void lcl_RedlineNotification(RedlineNotification nType, size_t nPos, SwRangeRedline* pRedline) +static void lcl_RedlineNotification(RedlineNotification nType, SwRedlineTable::size_type nPos, SwRangeRedline* pRedline) { if (!comphelper::LibreOfficeKit::isActive()) return; @@ -336,7 +336,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p ) if( p->HasValidRange() ) { std::pair<vector_type::const_iterator, bool> rv = maVector.insert( p ); - size_t nP = rv.first - begin(); + size_type nP = rv.first - begin(); lcl_RedlineNotification(RedlineNotification::Add, nP, p); p->CallDisplayFunc(nP); return rv.second; @@ -344,7 +344,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p ) return InsertWithValidRanges( p ); } -bool SwRedlineTable::Insert( SwRangeRedline* p, sal_uInt16& rP ) +bool SwRedlineTable::Insert( SwRangeRedline* p, size_type& rP ) { if( p->HasValidRange() ) { @@ -356,7 +356,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p, sal_uInt16& rP ) return InsertWithValidRanges( p, &rP ); } -bool SwRedlineTable::InsertWithValidRanges( SwRangeRedline* p, sal_uInt16* pInsPos ) +bool SwRedlineTable::InsertWithValidRanges( SwRangeRedline* p, size_type* pInsPos ) { // Create valid "sub-ranges" from the Selection bool bAnyIns = false; @@ -376,7 +376,7 @@ bool SwRedlineTable::InsertWithValidRanges( SwRangeRedline* p, sal_uInt16* pInsP } SwRangeRedline* pNew = nullptr; - sal_uInt16 nInsPos; + size_type nInsPos; if( aNewStt < *pEnd ) do { @@ -478,24 +478,24 @@ SwRedlineTable::~SwRedlineTable() maVector.DeleteAndDestroyAll(); } -sal_uInt16 SwRedlineTable::GetPos(const SwRangeRedline* p) const +SwRedlineTable::size_type SwRedlineTable::GetPos(const SwRangeRedline* p) const { vector_type::const_iterator it = maVector.find(const_cast<SwRangeRedline* const>(p)); if( it == maVector.end() ) - return USHRT_MAX; + return npos; return it - maVector.begin(); } bool SwRedlineTable::Remove( const SwRangeRedline* p ) { - const sal_uInt16 nPos = GetPos(p); - if (nPos == USHRT_MAX) + const size_type nPos = GetPos(p); + if (nPos == npos) return false; Remove(nPos); return true; } -void SwRedlineTable::Remove( sal_uInt16 nP ) +void SwRedlineTable::Remove( size_type nP ) { lcl_RedlineNotification(RedlineNotification::Remove, nP, maVector[nP]); SwDoc* pDoc = nullptr; @@ -515,7 +515,7 @@ void SwRedlineTable::DeleteAndDestroyAll() DeleteAndDestroy(0, size()); } -void SwRedlineTable::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) +void SwRedlineTable::DeleteAndDestroy( size_type nP, size_type nL ) { SwDoc* pDoc = nullptr; if( !nP && nL && nL == size() ) @@ -536,29 +536,29 @@ void SwRedlineTable::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) pSh->InvalidateWindows( SwRect( 0, 0, SAL_MAX_INT32, SAL_MAX_INT32 ) ); } -sal_uInt16 SwRedlineTable::FindNextOfSeqNo( sal_uInt16 nSttPos ) const +SwRedlineTable::size_type SwRedlineTable::FindNextOfSeqNo( size_type nSttPos ) const { - return static_cast<size_t>(nSttPos) + 1 < size() + return nSttPos + 1 < size() ? FindNextSeqNo( operator[]( nSttPos )->GetSeqNo(), nSttPos+1 ) - : USHRT_MAX; + : npos; } -sal_uInt16 SwRedlineTable::FindPrevOfSeqNo( sal_uInt16 nSttPos ) const +SwRedlineTable::size_type SwRedlineTable::FindPrevOfSeqNo( size_type nSttPos ) const { return nSttPos ? FindPrevSeqNo( operator[]( nSttPos )->GetSeqNo(), nSttPos-1 ) - : USHRT_MAX; + : npos; } /// Find the next or preceding Redline with the same seq.no. /// We can limit the search using look ahead (0 searches the whole array). -sal_uInt16 SwRedlineTable::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos ) const +SwRedlineTable::size_type SwRedlineTable::FindNextSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const { - sal_uInt16 nLookahead = 20; - sal_uInt16 nRet = USHRT_MAX; + auto const nLookahead = 20; + size_type nRet = npos; if( nSeqNo && nSttPos < size() ) { - size_t nEnd = size(); - const size_t nTmp = static_cast<size_t>(nSttPos)+ static_cast<size_t>(nLookahead); + size_type nEnd = size(); + const size_type nTmp = nSttPos + nLookahead; if (nTmp < nEnd) { nEnd = nTmp; @@ -574,13 +574,13 @@ sal_uInt16 SwRedlineTable::FindNextSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos return nRet; } -sal_uInt16 SwRedlineTable::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos ) const +SwRedlineTable::size_type SwRedlineTable::FindPrevSeqNo( sal_uInt16 nSeqNo, size_type nSttPos ) const { - sal_uInt16 nLookahead = 20; - sal_uInt16 nRet = USHRT_MAX; + auto const nLookahead = 20; + size_type nRet = npos; if( nSeqNo && nSttPos < size() ) { - size_t nEnd = 0; + size_type nEnd = 0; if( nSttPos > nLookahead ) nEnd = nSttPos - nLookahead; @@ -596,7 +596,7 @@ sal_uInt16 SwRedlineTable::FindPrevSeqNo( sal_uInt16 nSeqNo, sal_uInt16 nSttPos } const SwRangeRedline* SwRedlineTable::FindAtPosition( const SwPosition& rSttPos, - sal_uInt16& rPos, + size_type& rPos, bool bNext ) const { const SwRangeRedline* pFnd = nullptr; diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index b1c7e17598bd..8b9b5286a924 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -1283,7 +1283,7 @@ static SpellContentPositions lcl_CollectDeletedRedlines(SwEditShell* pSh) const SwPosition* pStartPos = pCursor->Start(); const SwTextNode* pTextNode = pCursor->GetNode().GetTextNode(); - sal_uInt16 nAct = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *pTextNode, USHRT_MAX ); + SwRedlineTable::size_type nAct = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *pTextNode, USHRT_MAX ); const sal_Int32 nStartIndex = pStartPos->nContent.GetIndex(); for ( ; nAct < pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); nAct++ ) { diff --git a/sw/source/core/edit/edredln.cxx b/sw/source/core/edit/edredln.cxx index d63f3ac26f96..fe92707fb6a2 100644 --- a/sw/source/core/edit/edredln.cxx +++ b/sw/source/core/edit/edredln.cxx @@ -47,12 +47,12 @@ bool SwEditShell::IsRedlineOn() const return GetDoc()->getIDocumentRedlineAccess().IsRedlineOn(); } -sal_uInt16 SwEditShell::GetRedlineCount() const +SwRedlineTable::size_type SwEditShell::GetRedlineCount() const { return GetDoc()->getIDocumentRedlineAccess().GetRedlineTable().size(); } -const SwRangeRedline& SwEditShell::GetRedline( sal_uInt16 nPos ) const +const SwRangeRedline& SwEditShell::GetRedline( SwRedlineTable::size_type nPos ) const { return *GetDoc()->getIDocumentRedlineAccess().GetRedlineTable()[ nPos ]; } @@ -66,7 +66,7 @@ static void lcl_InvalidateAll( SwViewShell* pSh ) } } -bool SwEditShell::AcceptRedline( sal_uInt16 nPos ) +bool SwEditShell::AcceptRedline( SwRedlineTable::size_type nPos ) { SET_CURR_SHELL( this ); StartAllAction(); @@ -77,7 +77,7 @@ bool SwEditShell::AcceptRedline( sal_uInt16 nPos ) return bRet; } -bool SwEditShell::RejectRedline( sal_uInt16 nPos ) +bool SwEditShell::RejectRedline( SwRedlineTable::size_type nPos ) { SET_CURR_SHELL( this ); StartAllAction(); @@ -138,16 +138,16 @@ void SwEditShell::UpdateRedlineAttr() /** Search the Redline of the data given * - * @return Returns the Pos of the Array, or USHRT_MAX if not present + * @return Returns the Pos of the Array, or SwRedlineTable::npos if not present */ -sal_uInt16 SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const +SwRedlineTable::size_type SwEditShell::FindRedlineOfData( const SwRedlineData& rData ) const { const SwRedlineTable& rTable = GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); - for( sal_uInt16 i = 0, nCnt = rTable.size(); i < nCnt; ++i ) + for( SwRedlineTable::size_type i = 0, nCnt = rTable.size(); i < nCnt; ++i ) if( &rTable[ i ]->GetRedlineData() == &rData ) return i; - return USHRT_MAX; + return SwRedlineTable::npos; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/inc/DocumentRedlineManager.hxx b/sw/source/core/inc/DocumentRedlineManager.hxx index bdcd45c5fc67..6aa688ba04ea 100644 --- a/sw/source/core/inc/DocumentRedlineManager.hxx +++ b/sw/source/core/inc/DocumentRedlineManager.hxx @@ -67,7 +67,7 @@ public: /*[in]*/bool bSaveInUndo, /*[in]*/sal_uInt16 nDelType) override; - virtual sal_uInt16 GetRedlinePos( + virtual SwRedlineTable::size_type GetRedlinePos( /*[in]*/const SwNode& rNode, /*[in]*/sal_uInt16 nType) const override; @@ -75,17 +75,17 @@ public: virtual const SwRangeRedline* GetRedline( /*[in]*/const SwPosition& rPos, - /*[in]*/sal_uInt16* pFndPos) const override; + /*[in]*/SwRedlineTable::size_type* pFndPos) const override; virtual bool IsRedlineMove() const override; virtual void SetRedlineMove(/*[in]*/bool bFlag) override; - virtual bool AcceptRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) override; + virtual bool AcceptRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) override; virtual bool AcceptRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) override; - virtual bool RejectRedline(/*[in]*/sal_uInt16 nPos, /*[in]*/bool bCallDelete) override; + virtual bool RejectRedline(/*[in]*/SwRedlineTable::size_type nPos, /*[in]*/bool bCallDelete) override; virtual bool RejectRedline(/*[in]*/const SwPaM& rPam, /*[in]*/bool bCallDelete) override; diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index c2fa4eae3eee..412e5c6af114 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -387,7 +387,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const } else { - if ( USHRT_MAX == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) ) + if ( SwRedlineTable::npos == rIDRA.GetRedlinePos(rTextNode, USHRT_MAX) ) bRedLine = false; if( bLineNum && rLineInf.IsCountBlankLines() && @@ -484,8 +484,8 @@ bool SwTextFrame::PaintEmpty( const SwRect &rRect, bool bCheck ) const const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) ) { - const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); - if( USHRT_MAX != nRedlPos ) + const SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); + if( SwRedlineTable::npos != nRedlPos ) { SwAttrHandler aAttrHandler; aAttrHandler.Init( rTextNode.GetSwAttrSet(), diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index c37319d06b62..779e6f0096bf 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -2162,7 +2162,7 @@ void SwScriptInfo::selectRedLineDeleted(const SwTextNode& rNode, MultiSelection const IDocumentRedlineAccess& rIDRA = rNode.getIDocumentRedlineAccess(); if ( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) ) { - sal_uInt16 nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); + SwRedlineTable::size_type nAct = rIDRA.GetRedlinePos( rNode, USHRT_MAX ); for ( ; nAct < rIDRA.GetRedlineTable().size(); nAct++ ) { diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx index 8521b755837d..21866544c57f 100644 --- a/sw/source/core/text/porrst.cxx +++ b/sw/source/core/text/porrst.cxx @@ -252,8 +252,8 @@ SwTwips SwTextFrame::EmptyHeight() const const IDocumentRedlineAccess& rIDRA = rTextNode.getIDocumentRedlineAccess(); if( IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ) ) { - const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); - if( USHRT_MAX != nRedlPos ) + const SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); + if( SwRedlineTable::npos != nRedlPos ) { SwAttrHandler aAttrHandler; aAttrHandler.Init( GetTextNode()->GetSwAttrSet(), diff --git a/sw/source/core/text/redlnitr.cxx b/sw/source/core/text/redlnitr.cxx index 49c4a5e69700..1fb498ebb919 100644 --- a/sw/source/core/text/redlnitr.cxx +++ b/sw/source/core/text/redlnitr.cxx @@ -134,8 +134,8 @@ void SwAttrIter::CtorInitAttrIter( SwTextNode& rTextNode, SwScriptInfo& rScrInf, const bool bShow = IDocumentRedlineAccess::IsShowChanges( rIDRA.GetRedlineFlags() ); if( pExtInp || bShow ) { - const sal_uInt16 nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); - if( pExtInp || USHRT_MAX != nRedlPos ) + const SwRedlineTable::size_type nRedlPos = rIDRA.GetRedlinePos( rTextNode, USHRT_MAX ); + if( pExtInp || SwRedlineTable::npos != nRedlPos ) { const std::vector<ExtTextInputAttr> *pArr = nullptr; sal_Int32 nInputStt = 0; diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index bca3c90c5d72..b44e7ebbf7ad 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3212,8 +3212,8 @@ OUString SwTextNode::GetRedlineText() const { std::vector<sal_Int32> aRedlArr; const SwDoc* pDoc = GetDoc(); - sal_uInt16 nRedlPos = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *this, nsRedlineType_t::REDLINE_DELETE ); - if( USHRT_MAX != nRedlPos ) + SwRedlineTable::size_type nRedlPos = pDoc->getIDocumentRedlineAccess().GetRedlinePos( *this, nsRedlineType_t::REDLINE_DELETE ); + if( SwRedlineTable::npos != nRedlPos ) { // some redline-delete object exists for the node const sal_uLong nNdIdx = GetIndex(); diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 5054698874f4..0636499f9c57 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -135,7 +135,7 @@ lcl_MaskRedlines( const SwTextNode& rNode, OUStringBuffer& rText, const SwDoc& rDoc = *rNode.GetDoc(); - for ( size_t nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( rNode, USHRT_MAX ); nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nAct ) + for ( SwRedlineTable::size_type nAct = rDoc.getIDocumentRedlineAccess().GetRedlinePos( rNode, USHRT_MAX ); nAct < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(); ++nAct ) { const SwRangeRedline* pRed = rDoc.getIDocumentRedlineAccess().GetRedlineTable()[ nAct ]; diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index 81cad0213685..eae583195d0f 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -999,7 +999,7 @@ bool SwUndo::FillSaveData( const SwPosition* pStt = rRange.Start(); const SwPosition* pEnd = rRange.End(); const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; rRange.GetDoc()->getIDocumentRedlineAccess().GetRedline( *pStt, &n ); for ( ; n < rTable.size(); ++n ) { @@ -1031,7 +1031,7 @@ bool SwUndo::FillSaveDataForFormat( const SwPosition *pStt = rRange.Start(), *pEnd = rRange.End(); const SwRedlineTable& rTable = rRange.GetDoc()->getIDocumentRedlineAccess().GetRedlineTable(); - sal_uInt16 n = 0; + SwRedlineTable::size_type n = 0; rRange.GetDoc()->getIDocumentRedlineAccess().GetRedline( *pStt, &n ); for ( ; n < rTable.size(); ++n ) { diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 8684ee77e846..5e6a7c3f1599 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -238,10 +238,10 @@ void SwUndoRedlineSort::UndoRedlineImpl(SwDoc & rDoc, SwPaM & rPam) // Search both Redline objects and make them visible to make the nodes // consistent again. The 'delete' one is hidden, thus search for the // 'insert' Redline object. The former is located directly after the latter. - sal_uInt16 nFnd = rDoc.getIDocumentRedlineAccess().GetRedlinePos( + SwRedlineTable::size_type nFnd = rDoc.getIDocumentRedlineAccess().GetRedlinePos( *rDoc.GetNodes()[ nSttNode + 1 ], nsRedlineType_t::REDLINE_INSERT ); - OSL_ENSURE( USHRT_MAX != nFnd && nFnd+1 < (sal_uInt16)rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(), + OSL_ENSURE( SwRedlineTable::npos != nFnd && nFnd+1 < rDoc.getIDocumentRedlineAccess().GetRedlineTable().size(), "could not find an Insert object" ); ++nFnd; rDoc.getIDocumentRedlineAccess().GetRedlineTable()[nFnd]->Show(1, nFnd); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index bfd8a1414b3b..f44bd94ee2bb 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -182,7 +182,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTextNode& rTextNd) : maCharRuns(GetPseudoCharRuns(rTextNd)), pCurRedline(nullptr), nAktSwPos(0), - nCurRedlinePos(USHRT_MAX), + nCurRedlinePos(SwRedlineTable::npos), mrSwFormatDrop(rTextNd.GetSwAttrSet().GetDrop()) { @@ -267,7 +267,7 @@ sal_Int32 SwWW8AttrIter::SearchNext( sal_Int32 nStartPos ) if ( nCurRedlinePos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size() ) { // nCurRedlinePos point to the next redline - sal_uInt16 nRedLinePos = nCurRedlinePos; + SwRedlineTable::size_type nRedLinePos = nCurRedlinePos; if( pCurRedline ) ++nRedLinePos; @@ -1330,7 +1330,7 @@ int SwWW8AttrIter::OutAttrWithRange(sal_Int32 nPos) bool SwWW8AttrIter::IncludeEndOfParaCRInRedlineProperties( sal_Int32 nEnd ) const { // search next Redline - for( size_t nPos = nCurRedlinePos; + for( SwRedlineTable::size_type nPos = nCurRedlinePos; nPos < m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); ++nPos ) { const SwRangeRedline *pRange = m_rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[nPos]; @@ -1699,8 +1699,8 @@ OUString SwWW8AttrIter::GetSnippet(const OUString &rStr, sal_Int32 nAktPos, */ static SwTextFormatColl& lcl_getFormatCollection( MSWordExportBase& rExport, const SwTextNode* pTextNode ) { - sal_uInt16 nPos = 0; - sal_uInt16 nMax = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); + SwRedlineTable::size_type nPos = 0; + SwRedlineTable::size_type nMax = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable().size(); while( nPos < nMax ) { const SwRangeRedline* pRedl = rExport.m_pDoc->getIDocumentRedlineAccess().GetRedlineTable()[ nPos++ ]; diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 10ccb857eb28..d4e58c5fc2da 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -1462,7 +1462,7 @@ private: const SwRangeRedline* pCurRedline; sal_Int32 nAktSwPos; - sal_uInt16 nCurRedlinePos; + SwRedlineTable::size_type nCurRedlinePos; bool mbParaIsRTL; diff --git a/sw/source/uibase/inc/redlndlg.hxx b/sw/source/uibase/inc/redlndlg.hxx index fd5d59442eef..3328920b8b58 100644 --- a/sw/source/uibase/inc/redlndlg.hxx +++ b/sw/source/uibase/inc/redlndlg.hxx @@ -103,16 +103,16 @@ class SW_DLLPUBLIC SwRedlineAcceptDlg final DECL_DLLPRIVATE_LINK( GotoHdl, Timer*, void ); DECL_DLLPRIVATE_LINK( CommandHdl, SvSimpleTable*, void ); - SAL_DLLPRIVATE sal_uInt16 CalcDiff(sal_uInt16 nStart, bool bChild); + SAL_DLLPRIVATE SwRedlineTable::size_type CalcDiff(SwRedlineTable::size_type nStart, bool bChild); SAL_DLLPRIVATE void InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFormat); - SAL_DLLPRIVATE void InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd = USHRT_MAX); - SAL_DLLPRIVATE void RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd); + SAL_DLLPRIVATE void InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd = SwRedlineTable::npos); + SAL_DLLPRIVATE void RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd); SAL_DLLPRIVATE void InitAuthors(); SAL_DLLPRIVATE static OUString GetRedlineText(const SwRangeRedline& rRedln, DateTime &rDateTime, sal_uInt16 nStack = 0); SAL_DLLPRIVATE Image GetActionImage(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0); SAL_DLLPRIVATE OUString GetActionText(const SwRangeRedline& rRedln, sal_uInt16 nStack = 0); - SAL_DLLPRIVATE static sal_uInt16 GetRedlinePos( const SvTreeListEntry& rEntry); + SAL_DLLPRIVATE static SwRedlineTable::size_type GetRedlinePos( const SvTreeListEntry& rEntry); SwRedlineAcceptDlg(SwRedlineAcceptDlg const&) = delete; SwRedlineAcceptDlg& operator=(SwRedlineAcceptDlg const&) = delete; @@ -126,7 +126,7 @@ public: inline SvxAcceptChgCtr& GetChgCtrl() { return *m_aTabPagesCTRL.get(); } inline bool HasRedlineAutoFormat() const { return m_bRedlnAutoFormat; } - void Init(sal_uInt16 nStart = 0); + void Init(SwRedlineTable::size_type nStart = 0); void CallAcceptReject( bool bSelect, bool bAccept ); void Initialize(const OUString &rExtraData); diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx index 894e3cbe2658..2a7a21673b3d 100644 --- a/sw/source/uibase/inc/wrtsh.hxx +++ b/sw/source/uibase/inc/wrtsh.hxx @@ -464,7 +464,7 @@ typedef bool (SwWrtShell:: *FNSimpleMove)(); bool GotoNextTOXBase( const OUString* pName = nullptr); bool GotoTable( const OUString& rName ); bool GotoFormatField( const SwFormatField& rField ); - const SwRangeRedline* GotoRedline( sal_uInt16 nArrPos, bool bSelect); + const SwRangeRedline* GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect); void ChangeHeaderOrFooter(const OUString& rStyleName, bool bHeader, bool bOn, bool bShowWarning); virtual void SetShowHeaderFooterSeparator( FrameControlType eControl, bool bShow ) override; diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx index 57653935791f..bb3cf0da6858 100644 --- a/sw/source/uibase/misc/redlndlg.cxx +++ b/sw/source/uibase/misc/redlndlg.cxx @@ -227,7 +227,7 @@ SwRedlineAcceptDlg::~SwRedlineAcceptDlg() m_aTabPagesCTRL.disposeAndClear(); } -void SwRedlineAcceptDlg::Init(sal_uInt16 nStart) +void SwRedlineAcceptDlg::Init(SwRedlineTable::size_type nStart) { SwWait aWait( *::GetActiveView()->GetDocShell(), false ); m_pTable->SetUpdateMode(false); @@ -266,14 +266,13 @@ void SwRedlineAcceptDlg::InitAuthors() OUString sOldAuthor(pFilterPage->GetSelectedAuthor()); pFilterPage->ClearAuthors(); - sal_uInt16 nCount = pSh->GetRedlineCount(); + SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); m_bOnlyFormatedRedlines = true; bool bIsNotFormated = false; - sal_uInt16 i; // determine authors - for ( i = 0; i < nCount; i++) + for ( SwRedlineTable::size_type i = 0; i < nCount; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); @@ -291,8 +290,8 @@ void SwRedlineAcceptDlg::InitAuthors() std::sort(aStrings.begin(), aStrings.end()); aStrings.erase(std::unique(aStrings.begin(), aStrings.end()), aStrings.end()); - for (i = 0; i < aStrings.size(); i++) - pFilterPage->InsertAuthor(aStrings[i]); + for (auto const & i: aStrings) + pFilterPage->InsertAuthor(i); if (pFilterPage->SelectAuthor(sOldAuthor) == LISTBOX_ENTRY_NOTFOUND && !aStrings.empty()) pFilterPage->SelectAuthor(aStrings[0]); @@ -305,8 +304,8 @@ void SwRedlineAcceptDlg::InitAuthors() { // find the selected redline // (fdo#57874: ignore, if the redline is already gone) - sal_uInt16 nPos = GetRedlinePos(*pSelEntry); - if( nPos != USHRT_MAX ) + SwRedlineTable::size_type nPos = GetRedlinePos(*pSelEntry); + if( nPos != SwRedlineTable::npos ) { const SwRangeRedline& rRedln = pSh->GetRedline( nPos ); @@ -392,12 +391,10 @@ void SwRedlineAcceptDlg::Activate() // did something change? SwWrtShell* pSh = pView->GetWrtShellPtr(); - sal_uInt16 nCount = pSh->GetRedlineCount(); + SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); // check the number of pointers - sal_uInt16 i; - - for ( i = 0; i < nCount; i++) + for ( SwRedlineTable::size_type i = 0; i < nCount; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); @@ -412,7 +409,7 @@ void SwRedlineAcceptDlg::Activate() if (&rRedln.GetRedlineData() != pParent->pData) { // Redline-Parents were inserted, changed or deleted - if ((i = CalcDiff(i, false)) == USHRT_MAX) + if ((i = CalcDiff(i, false)) == SwRedlineTable::npos) return; continue; } @@ -423,7 +420,7 @@ void SwRedlineAcceptDlg::Activate() if (!pRedlineData && pBackupData) { // Redline-Children were deleted - if ((i = CalcDiff(i, true)) == USHRT_MAX) + if ((i = CalcDiff(i, true)) == SwRedlineTable::npos) return; continue; } @@ -434,7 +431,7 @@ void SwRedlineAcceptDlg::Activate() if (pRedlineData != pBackupData->pChild) { // Redline-Children were inserted, changed or deleted - if ((i = CalcDiff(i, true)) == USHRT_MAX) + if ((i = CalcDiff(i, true)) == SwRedlineTable::npos) return; continue; } @@ -452,7 +449,7 @@ void SwRedlineAcceptDlg::Activate() } // check comment - for (i = 0; i < nCount; i++) + for (SwRedlineTable::size_type i = 0; i < nCount; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); SwRedlineDataParent *const pParent = m_RedlineParents[i].get(); @@ -472,12 +469,12 @@ void SwRedlineAcceptDlg::Activate() InitAuthors(); } -sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild) +SwRedlineTable::size_type SwRedlineAcceptDlg::CalcDiff(SwRedlineTable::size_type nStart, bool bChild) { if (!nStart) { Init(); - return USHRT_MAX; + return SwRedlineTable::npos; } m_pTable->SetUpdateMode(false); @@ -521,7 +518,7 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild) // have entries been deleted? const SwRedlineData *pRedlineData = &rRedln.GetRedlineData(); - for (size_t i = nStart + 1; i < m_RedlineParents.size(); i++) + for (SwRedlineTable::size_type i = nStart + 1; i < m_RedlineParents.size(); i++) { if (m_RedlineParents[i]->pData == pRedlineData) { @@ -533,10 +530,10 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild) } // entries been inserted? - sal_uInt16 nCount = pSh->GetRedlineCount(); + SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); pRedlineData = m_RedlineParents[nStart]->pData; - for (sal_uInt16 i = nStart + 1; i < nCount; i++) + for (SwRedlineTable::size_type i = nStart + 1; i < nCount; i++) { if (&pSh->GetRedline(i).GetRedlineData() == pRedlineData) { @@ -549,7 +546,7 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild) m_pTable->SetUpdateMode(true); Init(nStart); // adjust all entries until the end - return USHRT_MAX; + return SwRedlineTable::npos; } void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRangeRedline& rRedln, const sal_uInt16 nAutoFormat) @@ -637,10 +634,10 @@ void SwRedlineAcceptDlg::InsertChildren(SwRedlineDataParent *pParent, const SwRa } } -void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd) +void SwRedlineAcceptDlg::RemoveParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd) { SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); - sal_uInt16 nCount = pSh->GetRedlineCount(); + SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); std::vector<SvTreeListEntry*> aLBoxArr; @@ -652,7 +649,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd) // set the cursor after the last entry because otherwise performance problem in TLB. // TLB would otherwise reset the cursor at every Remove (expensive) - sal_uInt16 nPos = std::min((sal_uInt16)nCount, (sal_uInt16)m_RedlineParents.size()); + SwRedlineTable::size_type nPos = std::min(nCount, m_RedlineParents.size()); SvTreeListEntry *pCurEntry = nullptr; while( ( pCurEntry == nullptr ) && ( nPos > 0 ) ) { @@ -665,7 +662,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd) SvTreeList* pModel = m_pTable->GetModel(); - for (sal_uInt16 i = nStart; i <= nEnd; i++) + for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++) { if (!bChildrenRemoved && m_RedlineParents[i]->pNext) { @@ -714,17 +711,17 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd) m_RedlineParents.erase(m_RedlineParents.begin() + nStart, m_RedlineParents.begin() + nEnd + 1); } -void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) +void SwRedlineAcceptDlg::InsertParents(SwRedlineTable::size_type nStart, SwRedlineTable::size_type nEnd) { SwView *pView = ::GetActiveView(); SwWrtShell* pSh = pView->GetWrtShellPtr(); sal_uInt16 nAutoFormat = HasRedlineAutoFormat() ? nsRedlineType_t::REDLINE_FORM_AUTOFMT : 0; OUString sParent; - sal_uInt16 nCount = pSh->GetRedlineCount(); - nEnd = std::min((sal_uInt16)nEnd, (sal_uInt16)(nCount - 1)); // also treats nEnd=USHRT_MAX (until the end) + SwRedlineTable::size_type nCount = pSh->GetRedlineCount(); + nEnd = std::min(nEnd, (nCount - 1)); // also treats nEnd=SwRedlineTable::npos (until the end) - if (nEnd == USHRT_MAX) + if (nEnd == SwRedlineTable::npos) return; // no redlines in the document SvTreeListEntry *pParent; @@ -744,7 +741,7 @@ void SwRedlineAcceptDlg::InsertParents(sal_uInt16 nStart, sal_uInt16 nEnd) else pCurrRedline = nullptr; - for (sal_uInt16 i = nStart; i <= nEnd; i++) + for (SwRedlineTable::size_type i = nStart; i <= nEnd; i++) { const SwRangeRedline& rRedln = pSh->GetRedline(i); const SwRedlineData *pRedlineData = &rRedln.GetRedlineData(); @@ -807,7 +804,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) pEntry = bSelect ? m_pTable->NextSelected(pEntry) : m_pTable->Next(pEntry); } - bool (SwEditShell:: *FnAccRej)( sal_uInt16 ) = &SwEditShell::AcceptRedline; + bool (SwEditShell:: *FnAccRej)( SwRedlineTable::size_type ) = &SwEditShell::AcceptRedline; if( !bAccept ) FnAccRej = &SwEditShell::RejectRedline; @@ -841,8 +838,8 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) aIter != aEnd; ++aIter ) { - sal_uInt16 nPosition = GetRedlinePos( **aIter ); - if( nPosition != USHRT_MAX ) + SwRedlineTable::size_type nPosition = GetRedlinePos( **aIter ); + if( nPosition != SwRedlineTable::npos ) (pSh->*FnAccRej)( nPosition ); } @@ -873,7 +870,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept ) m_pTPView->EnableUndo(); } -sal_uInt16 SwRedlineAcceptDlg::GetRedlinePos( const SvTreeListEntry& rEntry ) +SwRedlineTable::size_type SwRedlineAcceptDlg::GetRedlinePos( const SvTreeListEntry& rEntry ) { SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr(); return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(static_cast<RedlinData *>( @@ -979,8 +976,8 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, GotoHdl, Timer *, void) bSel = true; // #98864# find the selected redline (ignore, if the redline is already gone) - sal_uInt16 nPos = GetRedlinePos(*pActEntry); - if( nPos != USHRT_MAX ) + SwRedlineTable::size_type nPos = GetRedlinePos(*pActEntry); + if( nPos != SwRedlineTable::npos ) { const SwRangeRedline& rRedln = pSh->GetRedline( nPos ); @@ -1024,10 +1021,10 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void) if (m_pTable->GetParent(pEntry)) pTopEntry = m_pTable->GetParent(pEntry); - sal_uInt16 nPos = GetRedlinePos(*pTopEntry); + SwRedlineTable::size_type nPos = GetRedlinePos(*pTopEntry); // disable commenting for protected areas - if (nPos != USHRT_MAX && (pRed = pSh->GotoRedline(nPos, true)) != nullptr) + if (nPos != SwRedlineTable::npos && (pRed = pSh->GotoRedline(nPos, true)) != nullptr) { if( pSh->IsCursorPtAtEnd() ) pSh->SwapPam(); @@ -1062,9 +1059,9 @@ IMPL_LINK_NOARG(SwRedlineAcceptDlg, CommandHdl, SvSimpleTable*, void) if (m_pTable->GetParent(pEntry)) pEntry = m_pTable->GetParent(pEntry); - sal_uInt16 nPos = GetRedlinePos(*pEntry); + SwRedlineTable::size_type nPos = GetRedlinePos(*pEntry); - if (nPos == USHRT_MAX) + if (nPos == SwRedlineTable::npos) return; const SwRangeRedline &rRedline = pSh->GetRedline(nPos); diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 9fa93e28003e..e14f7a7f7b26 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -663,11 +663,16 @@ void SwView::Execute(SfxRequest &rReq) { SwDoc *pDoc = m_pWrtShell->GetDoc(); SwPaM *pCursor = m_pWrtShell->GetCursor(); - sal_uInt16 nRedline = USHRT_MAX; + SwRedlineTable::size_type nRedline = SwRedlineTable::npos; if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) + { + //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch: nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + if (nRedline == USHRT_MAX) + nRedline = SwRedlineTable::npos; + } - if( pCursor->HasMark() && nRedline == USHRT_MAX) + if( pCursor->HasMark() && nRedline == SwRedlineTable::npos) { if (FN_REDLINE_ACCEPT_DIRECT == nSlot) m_pWrtShell->AcceptRedlinesInSelection(); @@ -681,7 +686,7 @@ void SwView::Execute(SfxRequest &rReq) // point at the *end* of the redline and the mark at the start (so GetRedline // would return NULL if called on the point) const SwRangeRedline* pRedline = nullptr; - if (nRedline < USHRT_MAX) + if (nRedline != SwRedlineTable::npos) { // A redline was explicitly requested by specifying an // index, don't guess based on the cursor position. @@ -708,9 +713,14 @@ void SwView::Execute(SfxRequest &rReq) { // If a parameter is provided, try going to the nth change, not to // the next one. - sal_uInt16 nRedline = USHRT_MAX; + SwRedlineTable::size_type nRedline = SwRedlineTable::npos; if (pArgs && pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) + { + //TODO: SfxUInt16Item vs. SwRedlineTable::size_type mismatch: nRedline = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + if (nRedline == USHRT_MAX) + nRedline = SwRedlineTable::npos; + } const SwRangeRedline *pCurrent = m_pWrtShell->GetCurrRedline(); SwDoc* pDoc = m_pWrtShell->GetDoc(); @@ -727,7 +737,7 @@ void SwView::Execute(SfxRequest &rReq) // This behavior means that PREV_CHANGE followed by NEXT_CHANGE would not change // the current redline, so we detect it and select the next redline again. - if (pCurrent && pCurrent == pNext && nRedline == USHRT_MAX) + if (pCurrent && pCurrent == pNext && nRedline == SwRedlineTable::npos) pNext = m_pWrtShell->SelNextRedline(); if (pNext) diff --git a/sw/source/uibase/uiview/viewstat.cxx b/sw/source/uibase/uiview/viewstat.cxx index 3bbedcbe02ea..0bfeda9fd1e8 100644 --- a/sw/source/uibase/uiview/viewstat.cxx +++ b/sw/source/uibase/uiview/viewstat.cxx @@ -291,7 +291,7 @@ void SwView::GetState(SfxItemSet &rSet) else if (pCursor->HasMark()) { // If the selection does not contain redlines, disable accepting/rejecting changes. - sal_uInt16 index = 0; + SwRedlineTable::size_type index = 0; const SwRedlineTable& table = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); const SwRangeRedline* redline = table.FindAtPosition( *pCursor->Start(), index ); if( redline != nullptr && *redline->Start() == *pCursor->End()) @@ -327,7 +327,7 @@ void SwView::GetState(SfxItemSet &rSet) if (comphelper::LibreOfficeKit::isActive()) { OString aPayload(".uno:TrackedChangeIndex="); - sal_uInt16 nRedline = 0; + SwRedlineTable::size_type nRedline = 0; if (pDoc->getIDocumentRedlineAccess().GetRedline(*pCursor->Start(), &nRedline)) aPayload += OString::number(nRedline); libreOfficeKitViewCallback(LOK_CALLBACK_STATE_CHANGED, aPayload.getStr()); diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index b26db5abca90..a58fa570de36 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -667,7 +667,7 @@ bool SwWrtShell::GotoFormatField( const SwFormatField& rField ) { return bRet; } -const SwRangeRedline* SwWrtShell::GotoRedline( sal_uInt16 nArrPos, bool bSelect ) { +const SwRangeRedline* SwWrtShell::GotoRedline( SwRedlineTable::size_type nArrPos, bool bSelect ) { SwPosition aPos = *GetCursor()->GetPoint(); const SwRangeRedline *pRedline = SwCursorShell::GotoRedline(nArrPos, bSelect); if (pRedline) |